I integrated CallKit framework to my app, and make an outgoing call.
I can see the outgoing call in native phone recents.
But when I tab the outgoing call and want to get phone info. It crashed.
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSUserActivity interaction]: unrecognized selector sent to instance 0x17d4ab90'
Here is my code in AppDelegate.m
- (BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity restorationHandler:(void(^)(NSArray * __nullable restorableObjects))restorationHandler NS_AVAILABLE_IOS(8_0){ INInteraction *interaction = userActivity.interaction;
INStartAudioCallIntent *startAudioCallIntent = (INStartAudioCallIntent *)interaction.intent;
INPerson *contact = startAudioCallIntent.contacts[0];
INPersonHandle *personHandle = contact.personHandle;
NSString *phoneNumber = personHandle.value;
}
I crashed in INInteraction *interaction = userActivity.interaction;
And I checked with interaction info
@property (readonly, nullable, NS_NONATOMIC_IOSONLY) INInteraction *interaction API_AVAILABLE(macosx(10.12), ios(10.0));
Following are my environment
mac: 10.12.1xcode: 8.1iOS: 10.1.1
It doesn't violate the requirement
I search all day but seems no one meet this problem.
Is there anything wrong about code level or have another way to get the phone information?