问题描述:

I am checking it with

- (void)applicationWillEnterForeground:(UIApplication *)application

when it comes back to the app.

But this one doesn't detect when the user declines the call. Is there anyway to detect even when the user declines the call?

网友答案:

Maybe you could use the following notifications, in your case, the second one:

Add CoreTelephony.framework to your project and:

#import <CoreTelephony/CTCall.h>

   [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(callReceived:) name:CTCallStateIncoming object:nil];
   [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(callEnded:) name:CTCallStateDisconnected object:nil];
   [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(callConnected:) name:CTCallStateConnected object:nil];
网友答案:

I think what you want is to detect when the app is coming back into an active state. There are two delegate methods for this:

applicationWillEnterForeground: Tells the delegate that the application is about to enter the foreground.

- (void)applicationWillEnterForeground:(UIApplication *)application

and

applicationDidBecomeActive: Tells the delegate that the application has become active.

- (void)applicationDidBecomeActive:(UIApplication *)application

more info in the documentation of UIApplicationDelegate

网友答案:

There isn't a way that I know of to tell when the call is declined. But this method is called when the user gets a call:

    - (void)applicationWillResignActive:(UIApplication *)application {
}
相关阅读:
Top