这个方法本来就是用来回写缓存,保存装态之类的吧。至于时间“Your implementation of this method has approximately five seconds to perform any tasks and return. If you need additional time to perform any final tasks, you can request additional execution time from the system by calling beginBackgroundTaskWithExpirationHandler:. In practice, you should return from applicationDidEnterBackground: as quickly as possible. If the method does not return before time runs out your application is terminated and purged from memory.”默认有5秒,如果不够可以用beginBackgroundTaskWithExpirationHandler:来延长,这个我没用过,可以google一下。一般5秒应该够吧了