问题描述
当我的iPhone应用程序进入后台模式时,我必须保留NSThread或NSTimer。可能吗 ?我已经启用了info.plist中的后台模式并打开了readstream和writestream,如下所示...(我正在使用UDP)
I have to keep a NSThread or NSTimer when my iPhone application goes into background mode. Is it possible ? I have enabled the background modes in info.plist and opened readstream and writestream as follows ...(I am using UDP)
CFWriteStreamSetProperty(writeStream, kCFStreamNetworkServiceType, kCFStreamNetworkServiceTypeVoIP);
但当我的应用程序进入后台和锁定状态时,NSThread或NSTimer没有打电话。那么请建议我如何在iPhone后台锁定状态下实现后台线程?
But when my application goes to background and locked state, NSThread or NSTimer is not calling . So please suggest me how to achieve background threading in iPhone background locked state ?
推荐答案
而不是 NSTimer
使用 UILocalNotification
可以在应用程序位于后台和前台时触发通知。
Instead of NSTimer
use UILocalNotification
which can fire notifications both when the app is in the background and in the foreground.
这篇关于在iOs 4后台模式下使用NSTimer或NSThread的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!