2

In my sample app it shows SIGPIPE error even though I ignored that signal on my main.m file

#import <UIKit/UIKit.h>

#import "AppDelegate.h"

int main(int argc, char *argv[])
{
    @autoreleasepool {
        signal(SIGPIPE, SIG_IGN);
        return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
    }
}

the back trace of gdb is

 #0  0x38579eb4 in mach_msg_trap ()
 #1  0x3857a04c in mach_msg ()
 #2  0x3605b044 in __CFRunLoopServiceMachPort ()
 #3  0x36059d5e in __CFRunLoopRun ()
 #4  0x35fccebc in CFRunLoopRunSpecific ()
 #5  0x35fccd48 in CFRunLoopRunInMode ()
 #6  0x328cf2ea in GSEventRunModal ()
 #7  0x32939300 in UIApplicationMain ()
 #8  0x000b6c52 in main (argc=1, argv=0x2fd4bc40) at   /Users/bdsu/Desktop/Git_repo/VoipApp_iOS/VoipApp_iOS/main.m:17

When I go to standby mode and come back then this error occurs. I have tested it on IPAD using IOS 6.0. Xcode version is 4.5/5.0 .

Tahlil
  • 2,680
  • 6
  • 43
  • 84

1 Answers1

2

My app needed internet connection while its on background. But not all app gets the permission to run on background. You have to set the app's background mode to voip app and also some other options are available to enable it to run on background. Also by default IOS suspends all apps after 10 minutes on the background and the socket was being closed which results in sigpipe error. That is why I wrote a function that will be called when the app goes to background and will keep the app alive. That way the app will get internet connection when running on background and avoid sigpipe.

Tahlil
  • 2,680
  • 6
  • 43
  • 84