Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iOS crashes on check permission #130

Closed
xiaobeiy opened this issue Jul 10, 2019 · 9 comments
Closed

iOS crashes on check permission #130

xiaobeiy opened this issue Jul 10, 2019 · 9 comments
Labels
platform: ios Issue is related to the iOS platform status: closed (missing info) Indicates the issue was automatically closed due to a lack of information.

Comments

@xiaobeiy
Copy link

🐛 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:

  • 📱 iOS
@BPHvZ
Copy link

BPHvZ commented Jul 14, 2019

I have the same problem

@evelyne24
Copy link

Same, it crashes the first time it requests permissions, after which it returns null.

@HishikiKenta
Copy link

Same issue, I tried it using real machine(iPhone7, iOS12.2) and emulator(iOS12.2, iOS11.4, iOS10.3), however both crashed.

@mvanbeusekom
Copy link
Member

@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.

@mvanbeusekom mvanbeusekom added platform: ios Issue is related to the iOS platform status: needs more info We need more information before we can continue work on this issue. labels Aug 6, 2019
@HishikiKenta
Copy link

I didn't add it. It works! Thank you @mvanbeusekom .

@alnaughty
Copy link

where can I find Info.plist? on to put the permissions on ios

@mvanbeusekom
Copy link
Member

@alnaughty it is located in the ios/Runner folder inside the root of you Application.

@Pradeepkn
Copy link

Pradeepkn commented Jan 30, 2020

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.

@kjawadDeveloper1
Copy link

@Pradeepkn have you found the solution for it?

@mvanbeusekom mvanbeusekom added status: closed (missing info) Indicates the issue was automatically closed due to a lack of information. and removed status: needs more info We need more information before we can continue work on this issue. labels Jul 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
platform: ios Issue is related to the iOS platform status: closed (missing info) Indicates the issue was automatically closed due to a lack of information.
Projects
None yet
Development

No branches or pull requests

8 participants