2013-04-23 48 views

回答

0

我不知道告诉何时拒绝来电。但这种方法被调用,当用户收到电话:

- (void)applicationWillResignActive:(UIApplication *)application { 
} 
4

也许你可以使用下面的通知,你的情况,第二个:

添加CoreTelephony.framework到您的项目和:

#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]; 
1

我想你想要的是检测应用何时回到活动状态。 有两种代表方法:

applicationWillEnterForeground: 告诉代理应用程序即将进入前台。

- (void)applicationWillEnterForeground:(UIApplication *)application 

applicationDidBecomeActive: 告诉应用程序已成为活跃的代表。在documentation of UIApplicationDelegate

- (void)applicationDidBecomeActive:(UIApplication *)application 

更多信息

相关问题