Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/118.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/iphone/35.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
当应用程序在后台运行(iOS7)时,如何继续套接字通信?_Ios_Iphone_Ios7_Xcode5 - Fatal编程技术网

当应用程序在后台运行(iOS7)时,如何继续套接字通信?

当应用程序在后台运行(iOS7)时,如何继续套接字通信?,ios,iphone,ios7,xcode5,Ios,Iphone,Ios7,Xcode5,我做了一个套接字通信(iOS7)。它工作正常,但当我的应用程序在后台运行时就会停止 谁能建议,如何继续套接字通信? 或 建议任何其他方法来实现它 谢谢,您是否检查了以下内容: - (void)applicationDidEnterBackground:(UIApplication *)application { // put stuff(code) to make continue socket communication // Use this method to releas

我做了一个套接字通信(iOS7)。它工作正常,但当我的应用程序在后台运行时就会停止

谁能建议,如何继续套接字通信? 或 建议任何其他方法来实现它

谢谢,

您是否检查了以下内容:

- (void)applicationDidEnterBackground:(UIApplication *)application
{
    // put stuff(code) to make continue socket communication
    // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 
    // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}

有关更多信息:当应用程序进入后台iOS时,请检查这些&&&&。

以确保必须断开套接字连接。但您可能正在后台执行某些任务。因此,在应用程序委托中,请使用beginbackgroundtaskexpirationhandler并创建后台任务的实例。对于iOS 7及更高版本,您将3分钟后收到回调,您必须结束所有剩余的任务。请确保通过UIApplication实例调用endbackgroundtask,否则应用程序将被强制终止。在此持续时间后,套接字连接将断开。如果您需要保持套接字连接,则必须将plist文件中的requirement添加到支持不同的背景模式,其中苹果支持七种不同的所需支持

它不工作继续,几分钟后停止工作。转换应符合应用程序关闭的要求。检查此项是否适用于VOIP。在我的情况下,客户端(可以是任何平台)和服务器(iOS本机应用程序)。您是否在应用程序的info plist文件中注册了后台模式的应用程序运行?是否为应用程序启用后台模式