开发者

iPhone identify home button pressed

开发者 https://www.devze.com 2023-03-18 18:57 出处:网络
How do I identify if the app was in the background when the home button was cli开发者_StackOverflow中文版cked and not by external events (sms, call, video call)?If the application is sent to backgroun

How do I identify if the app was in the background when the home button was cli开发者_StackOverflow中文版cked and not by external events (sms, call, video call)?


If the application is sent to background,

applicationDidEnterBackground 

will be getting called.

If it is by sms, call , video call, then,

applicationWillResignActive

will be getting called first. U can identify with that.


AFAIK there's no way. Look at UIApplicationDelegate documentation, you'll see :

- (void)applicationWillResignActive:(UIApplication *)application

This method is called to let your application know that it is about to move from the active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.

There's apparently no way to distinguish an interruption (SMS, call) or an exit (by pushing the Home button).

0

精彩评论

暂无评论...
验证码 换一张
取 消