_CTCallCopyAllCalls always returns empty array
I assume that _CTCallCopyAllCalls should return the call history but it returns an empty array...
Are you sure it doesn't return an array of active calls?
I can confirm _CTCallCopyAllCalls is working on my end. Usage example: https://www.dropbox.com/s/g0zs1sjyscmomb7/Screenshot%202014-03-21%2018.49.20.png You may also need a special entitlement to use this API in your own process.
Is there anything relevant in the syslog? iOS usually tells you if you're missing an entitlement.
Thanks for your hints.
Do you know the name of the entitlement? The only entry in the syslog that may be relevant is: <Error>: HID: The 'Passive' connection 'CallLog' access to protected services is denied.
My code looks like:
extern CFArrayRef _CTCallCopyAllCalls();
NSLog(@"call history: %@", _CTCallCopyAllCalls());
You can get the entitlements of a binary with ldid -e /path/to/binary. As the functions returns valid data in SpringBoard as well, comparing the entitlements of the Phone app and SpringBoard, one possible candidate is com.apple.private.icfcallserver. In case that doesn't work, use ldid and try the other entitlements of the Phone app or SpringBoard.
I see, so the device needs to be jailbroken to use that method?
No, not necessarily. You just need to get your app signed with the entitlement. However, I seriously doubt Apple will allow your app in the App Store if you use private entitlements & APIs.
That said, try this one:
com.apple.coretelephony.Calls.allow
It might work.
Thank you for your work guys, what do i need to do on my end to get this up and running?
See here:
https://stackoverflow.com/questions/19674514/how-to-create-entitlement-plist-file-in-xcode-5