flutterlocation
flutterlocation copied to clipboard
App crashes in iOS during init
Describe the bug
I have tried 'flutter clean'.
I took sample project from your sources.
App crashes in the place where it tries to get background modes;
self.applicationHasLocationBackgroundMode = [backgroundModes containsObject: @"location"];
Expected behavior App does not crash and I get location at least.
Tested on:
- iOS, Version 15.4 real device
Other plugins:
- None
Additional logs 2022-05-17 09:20:12.789114+0200 Runner[7491:279135] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSTaggedPointerString containsObject:]: unrecognized selector sent to instance 0xacadbad3624c29f2' *** First throw call stack: (0x1bf99cd78 0x1d8601734 0x1bfa7ab88 0x1bf931988 0x1bf930a60 0x102e581f8 0x102e5833c 0x10593594c 0x105486120 0x105802aec 0x105730204 0x105733f5c 0x1bf9b2168 0x1bf936144 0x1bf9308f0 0x1bf90efa0 0x1bf9226b8 0x1db9bc374 0x1c2287e88 0x1c20095ec 0x102e13268 0x102e99ce4) libc++abi: terminating with uncaught exception of type NSException dyld4 config: DYLD_LIBRARY_PATH=/usr/lib/system/introspection DYLD_INSERT_LIBRARIES=/Developer/usr/lib/libBacktraceRecording.dylib:/Developer/usr/lib/libMainThreadChecker.dylib:/Developer/Library/PrivateFrameworks/DTDDISupport.framework/libViewDebuggerSupport.dylib *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSTaggedPointerString containsObject:]: unrecognized selector sent to instance 0xacadbad3624c29f2' terminating with uncaught exception of type NSException
I got the same issue, I tried to rectify it by removing the line, it worked without background location.
In the file LocationPlugin.m
comment these lines for a quick fix.
// NSArray *backgroundModes = [NSBundle.mainBundle objectForInfoDictionaryKey:@"UIBackgroundModes"];
// self.applicationHasLocationBackgroundMode = [backgroundModes containsObject: @"location"];
Okay fixed this issue by adding this to Info.plist
<key>UIBackgroundModes</key>
<array>
<string>location</string>
</array>
Have you location permission key set yet n info.plist on iOS Without your App crashes immediately after start. Look in Xcode console for error description Am 23.04.2023 um 19:13 schrieb Nissim Dsilva @.***>: I got the same issue, I tried to rectify it by removing the line, it worked without background location. In the file LocationPlugin.m comment these lines for a quick fix. // NSArray *backgroundModes = [NSBundle.mainBundle objectForInfoDictionaryKey:@"UIBackgroundModes"]; // self.applicationHasLocationBackgroundMode = [backgroundModes containsObject: @"location"]; ``
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you are subscribed to this thread.Message ID: @.***>
Thank you all sorted and working great on iOS and android on my app.