iOS crashes on check permission
🐛 Bug Report
- permission_handler 3.1.0
- Flutter v1.5.4-hotfix.2 stable
- OSX 10.14.5
- Xcode version 10.2.1
My app is crashing when I check the permission in the iOS device, such as iPhone6 Plus, iPhone XR,Xs, etc.
await PermissionHandler().checkPermissionStatus(PermissionGroup.location)
Expected behavior
When executing the above code, it will return whether it is authorized, but now the app crash. The info is below:
Lost connection to device. *** First throw call stack: ( 0 CoreFoundation 0x000000010b9af1bb __exceptionPreprocess + 331 1 libobjc.A.dylib 0x000000010fe58735 objc_exception_throw + 48 2 CoreFoundation 0x000000010b8fb4ec _CFThrowFormattedException + 194 3 CoreFoundation 0x000000010ba1e541 -[__NSPlaceholderDictionary initWithObjects:forKeys:count:] + 321 4 CoreFoundation 0x000000010b9aac9b +[NSDictionary dictionaryWithObjects:forKeys:count:] + 59 5 Runner 0x000000010a3fdcde +[AmapLocationPlugin regeocode2map:] + 862 6 Runner 0x000000010a3fd594 __41-[AmapLocationPlugin getLocation:result:]_block_invoke + 1860 7 libdispatch.dylib 0x000000<…>
Reproduction steps
Configuration
NSLocationWhenInUseUsageDescription Target nearby businesses
Version: 1.x
Platform:
- :iphone: iOS
I have the same problem
Same, it crashes the first time it requests permissions, after which it returns null.
Same issue, I tried it using real machine(iPhone7, iOS12.2) and emulator(iOS12.2, iOS11.4, iOS10.3), however both crashed.
@xiaobeiy, @evelyne24, @BPHvZ and @HishikiKenta, have you added the necessary permissions in your Info.plist file? If those permissions are missing the application will indeed crash when trying to request permissions. Please see the Info.plist in our example app for details.
I didn't add it. It works! Thank you @mvanbeusekom .
where can I find Info.plist? on to put the permissions on ios
@alnaughty it is located in the ios/Runner folder inside the root of you Application.
Hi I am facing crash even after adding permission key in info.plist. Below is the crash log
Fatal Exception: NSRangeException *** -[__NSArrayM objectAtIndex:]: index 0 beyond bounds for empty array __51-[PermissionManager requestPermissions:completion:]_block_invoke
Fatal Exception: NSRangeException
0 CoreFoundation 0x2241e7ea0 __exceptionPreprocess
1 libobjc.A.dylib 0x2233b9a40 objc_exception_throw
2 CoreFoundation 0x22415f470 _CFArgv
3 CoreFoundation 0x2240cf758 -[__NSArrayM objectAtIndex:]
4 CoreFoundation 0x2240d31b0 -[NSMutableArray removeObject:]
5 Runner 0x100b47ae4 __51-[PermissionManager requestPermissions:completion:]_block_invoke + 53 (PermissionManager.m:53)
6 AddressBook 0x22fdda6a0 __46+[ABSAddressBook requestAccessWithCompletion:]_block_invoke
7 TCC 0x22703e8dc __TCCAccessRequest_block_invoke.77
8 TCC 0x227042a90 __tccd_send_message_block_invoke
9 libxpc.dylib 0x223e48514 _xpc_connection_reply_callout
10 libxpc.dylib 0x223e3bb3c _xpc_connection_call_reply_async
11 libdispatch.dylib 0x223c22504 _dispatch_client_callout3
12 libdispatch.dylib 0x223bda8a8 _dispatch_mach_msg_async_reply_invoke$VARIANT$mp
13 libdispatch.dylib 0x223bd283c _dispatch_kevent_worker_thread
14 libsystem_pthread.dylib 0x223e040ec _pthread_wqthread
15 libsystem_pthread.dylib 0x223e06cec start_wqthread
Above crash is happening only for contacts fetch.
@Pradeepkn have you found the solution for it?