簡體   English   中英

后台計時器IOS

[英]Background timer IOS

在我的應用中,借助計時器,用戶可以計划事件。 我希望即使應用程序在后台,該計時器也能正常工作。 我怎樣才能做到這一點 ?!

[NSTimer scheduledTimerWithTimeInterval:1 target:self selector:@selector(timerFired) userInfo:nil repeats:YES];

如果您希望在一段時間后觸發某些操作,即使該應用程序在后台運行,則本地通知也可以為您提供幫助。

請參閱https://developer.apple.com/library/ios/DOCUMENTATION/NetworkingInternet/Conceptual/RemoteNotificationsPG/Introduction.html

這里有教程http://www.appcoda.com/ios-programming-local-notification-tutorial/

注意:NSTimer將在應用進入后台時停止

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM