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

一个人想着一个人 提交于 2019-12-06 06:07:28

问题


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


回答1:


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




回答2:


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




回答3:


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.




回答4:


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.



来源:https://stackoverflow.com/questions/2184023/how-can-i-check-missed-call-in-iphone-using-objective-c

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!