How can I check missed call in iPhone using Object

2019-04-10 14:42发布

How can I check missed call in iPhone using Objective-C?

4条回答
贪生不怕死
2楼-- · 2019-04-10 15:04

There is no access to the iPhone phone from third party software. Luckily.

查看更多
唯我独甜
3楼-- · 2019-04-10 15:22

The sandbox prevents access to the phone functions from third-party apps. Thus there is no way to detect missed calls.

查看更多
相关推荐>>
4楼-- · 2019-04-10 15:22

When you have an incoming call, the function

- (void)applicationWillResignActive:(UIApplication *)application;

is called and if the call gets missed, the application will be active again and the function

- (void)applicationDidBecomeActive:(UIApplication *)application;

is called.

This way, you can detect missed calls. There is no other method to do this that i am aware of.

The only drawback is that these methods are also called when you Lock/Unlock the device when your application is active so you will not be able to know whether it was a missed call or the user locked the device.

查看更多
甜甜的少女心
5楼-- · 2019-04-10 15:26

Using Core Telephony framework, detect for call state changes. Listen for incoming calls. Now your application will be notified when there is an incoming call.

After this, when the alert pops up, applicationWillResignActive is called.

  1. If the user accepts the call, applicationDidEnterBackground is called, and then when user switches back to your application applicationDidBecomeActive will be called.
  2. If the user rejects the call or the calling person ends the call before accept/reject, applicationDidBecomeActive will be called.

The second case indicates a missed call.

查看更多
登录 后发表回答