- (void)applicationDidEnterBackground:(UIApplication *)application
{
for (int i =0; i<30; i++){
//add a local notification and schedule it
}
}
when app switch to background, these codes will freeze app in a while.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
There’s no document about UIApplication is thread safe or not.
After a long time test I found most time execute
LocalNotificationon background works well. but some times it just crash our app.So it seems like all the class with ‘UI’ prefixed are not thread safe and you should never invoke there’s methods on another thread.
And my solution is reduced the number of
LocalNotification, it still freeze app in a bit, but we thing we can accept this little freeze.