views:

259

answers:

1

i m making audio play background application error in following code in this code bgtask is undeclared i do not find bgtask is which kind of object

- (void)applicationDidEnterBackground:(UIApplication *)application 
{
    UIApplication  *app = [UIApplication sharedApplication];
    bgTask = [app beginBackgroundTaskWithExpirationHandler:^{ 
        [app endBackgroundTask:bgTask]; 
        bgTask = UIBackgroundTaskInvalid;
    }];

    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{});

    [app endBackgroundTask:bgTask]; bgTask = UIBackgroundTaskInvalid;
}
+1  A: 

You need to declare bgTask before you assign :)

UIBackgroundTaskIdentifier bgTask = nil;
willcodejavaforfood
thanks allot sir
sidhu
thanks sir it,s working now
sidhu
@sidhu - glad to help :)
willcodejavaforfood