Post not yet marked as solved
Post marked as unsolved with 0 replies, 1,182 views
This is how I request contacts framework access permission
-(void)askUserToAccessContacts
{
@try
{
if([CNContactStore class])
{
//iOS 9 or later
CNEntityType entityType = CNEntityTypeContacts;
if( [CNContactStore authorizationStatusForEntityType:entityType] == CNAuthorizationStatusNotDetermined)
{
CNContactStore * contactStore = [[CNContactStore alloc] init];
[contactStore requestAccessForEntityType:entityType completionHandler:^(BOOL granted, NSError * _Nullable error) {
if(granted){
DDLogVerbose(@"Permission granted for Contacts access...");
}
}];
}
else if( [CNContactStore authorizationStatusForEntityType:entityType]== CNAuthorizationStatusAuthorized)
{
DDLogVerbose(@"Permission granted for Contacts access !!!");
}
else
{
DDLogVerbose(@"Permission not granted for Contacts access !!!");
}
}
} @catch (NSException *exception) {
[[WriteLogger getWriteLogger] writeLog:@"AppDelegate" sourceClass:NSStringFromClass([self class]) methodName:NSStringFromSelector(_cmd) exception:exception exceptionDict:nil];
}
}
What could possibly cause the app to crash?
By the way, this crash is not occurring all the time, it happens randomly when I install the app and launch it for the first time.
Incident Identifier: 33DC6088-0DC6-40A1-91E5-F7A76E3154EB
Hardware Model: iPhone12,8
Version: 21.10.0 (0.5.2)
AppStoreTools: 13C90b
AppVariant: 1:iPhone12,8:15
Beta: YES
Code Type: ARM-64 (Native)
Role: Foreground
Parent Process: launchd [1]
Date/Time: 2022-01-10 11:43:38.9707 +0530
Launch Time: 2022-01-10 11:43:17.9333 +0530
OS Version: iPhone OS 15.1 (19B74)
Release Type: User
Baseband Version: 3.00.00
Report Version: 104
Exception Type: EXC_CRASH (SIGKILL)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note: EXC_CORPSE_NOTIFY
Triggered by Thread: 0
Kernel Triage:
VM - pmap_enter failed with resource shortage
VM - pmap_enter failed with resource shortage
VM - pmap_enter failed with resource shortage
VM - pmap_enter failed with resource shortage
VM - pmap_enter failed with resource shortage
Thread 0 name:
Thread 0 Crashed:
0 libsystem_kernel.dylib 0x00000001b73d0504 mach_msg_trap + 8
1 libsystem_kernel.dylib 0x00000001b73d0b9c mach_msg + 76 (mach_msg.c:119)
2 libdispatch.dylib 0x000000018019127c _dispatch_mach_send_and_wait_for_reply + 520 (mach.c:815)
3 libdispatch.dylib 0x000000018019162c dispatch_mach_send_with_result_and_wait_for_reply + 56 (mach.c:2019)
4 libxpc.dylib 0x00000001f083eb9c xpc_connection_send_message_with_reply_sync + 240 (connection.c:974)
5 TCC 0x00000001e78bb0c0 tccd_send_message + 940 (TCC.c:490)
6 TCC 0x00000001e78c0e08 __TCCAccessRequest_block_invoke.213 + 876 (TCC.c:591)
7 libdispatch.dylib 0x0000000180176660 _dispatch_client_callout + 20 (object.m:560)
8 libdispatch.dylib 0x00000001801858b4 _dispatch_lane_barrier_sync_invoke_and_complete + 56 (queue.c:1016)
9 libsystem_trace.dylib 0x000000019ac86668 _os_activity_initiate_impl + 64 (activity.c:131)
10 TCC 0x00000001e78bc4e0 TCCAccessRequest + 476 (TCC.c:1019)
11 TCC 0x00000001e78ba8b8 TCCAccessRestricted + 228 (TCC.c:1682)
12 ContactsFoundation 0x000000018ce4a6ec -[CNTCCVersion2 isAuthorizationRestricted] + 96 (CNTCCVersion2.m:79)
13 ContactsFoundation 0x000000018ce034a4 -[CNAuthorizationContext isAccessRestricted] + 52 (CNAuthorizationContext.m:90)
14 Contacts 0x0000000185c42b04 +[CNAuthorization isAccessRestrictedForEntityType:] + 72 (CNAuthorization.m:26)
15 Contacts 0x0000000185c5ba30 +[CNAuthorization authorizationStatusForEntityType:] + 40 (CNAuthorization.m:66)
16 ios_app 0x00000001024bc724 -[MainAppDelegate askUserToAccessContacts] + 84 (MainAppDelegate.m:1338)
17 ios_app 0x00000001024b61b8 -[MainAppDelegate application:didFinishLaunchingWithOptions:] + 1520 (MainAppDelegate.m:228)
log.crash