2013-04-23 52 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 

更多信息

相關問題