NSStream on Background didn't call

Posted by Iphone Developer on Stack Overflow See other posts from Stack Overflow or by Iphone Developer
Published on 2010-12-18T06:35:32Z Indexed on 2011/01/03 11:53 UTC
Read the original article Hit count: 319

Filed under:
|
|
|
|
- (void)applicationDidEnterBackground:(UIApplication *)application {
    NSOutputStream *outputStream;
    NSInputStream *inputStream;

    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{

        [inputStream setDelegate:self];
        [outputStream setDelegate:self];

        [inputStream scheduleInRunLoop:[NSRunLoop currentRunLoop]
                               forMode:NSRunLoopCommonModes];
        [outputStream scheduleInRunLoop:[NSRunLoop currentRunLoop]
                                forMode:NSRunLoopCommonModes];

        [app endBackgroundTask:bgTask];

        bgTask = UIBackgroundTaskInvalid;

    });
}

Input,OutputStream delegate didn't call.What i am doing wrong.

© Stack Overflow or respective owner

Related posts about iphone

Related posts about objective-c