-->

How to read the call log on iPhone iOS 5 programma

2020-07-17 03:02发布

问题:

I found many code samples for reading the call log on iOS 4, but it seems that this feature (reading the call log DB) is not enabled on iOS 5.

So what is the work-around? Is there any (third party?) method or trick to be able to read the call log in iOS 5?

回答1:

Take a look at the SpyPhone project on GitHub.

For example, you can get the most recently dialed number like so:

NSString *path = @"/var/mobile/Library/Preferences/com.apple.mobilephone.plist";
NSDictionary *dict = [NSDictionary dictionaryWithContentsOfFile:path];
NSString *lastDialed = [NSString stringWithFormat:@"%@", [d valueForKey:@"DialerSavedNumber"]];

This works on my iOS5 phone. I would not expect Apple to be happy with this sort of functionality anymore.