-
Notifications
You must be signed in to change notification settings - Fork 37
Open
Description
The use of Hot restart function in the console causes Dropbox iOS library to crash.
Related issue:
Hot Restart does not dispose native iOS/Android plugins.
flutter/flutter#69949
Dropbox iOS client library forces app crash:
(Bad software design I think. Should be just a warning.)
NSAssert(![DBOAuthManager sharedOAuthManager], @"Only call `[DBClientsManager setupWith...]` once");
Steps:
- Init Dropbox Library via flutter iOS (Simulator/iPhone)
- Press Shift+R in the console for hot restart the application
Observed:
*** Assertion failure in +[DBClientsManager setupWithOAuthManager:transportConfig:], DBClientsManager.m:106
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Only call `[DBClientsManager setupWith...]` once'
*** First throw call stack:
(0x195c31e48 0x18eefb8d8 0x1904ea94c 0x1058f6b68 0x1058f86e0 0x1058f85e0 0x102e3eacc 0x109ce276c 0x10973cb80 0x19d2434b4 0x19d244fdc 0x19d2537f4 0x19d253444 0x195cc26d8 0x195ca403c 0x195ca8ec0 0x1cfcff368 0x19819e86c 0x19819e4d0 0x102653e68 0x1b44ca960)
libc++abi: terminating with uncaught exception of type NSException
* thread #1, queue = 'com.apple.main-thread', stop reason = signal SIGABRT
frame #0: 0x00000001d35a3160 libsystem_kernel.dylib`__pthread_kill + 8
libsystem_kernel.dylib`:
-> 0x1d35a3160 <+8>: b.lo 0x1d35a3180 ; <+40>
0x1d35a3164 <+12>: pacibsp
0x1d35a3168 <+16>: stp x29, x30, [sp, #-0x10]!
0x1d35a316c <+20>: mov x29, sp
Target 0: (Runner) stopped.
Solution 1:
check static sharedOAuthManager if it has been initialised already and exit.
file: DropboxPlugin.m
} else if ([@"init" isEqualToString:call.method]) {
// NSString *clientId = call.arguments[@"clientId"];
NSString *key = call.arguments[@"key"];
// NSString *secret = call.arguments[@"secret"];
if ([DBOAuthManager sharedOAuthManager]) {
NSLog(@"Already initialized with appKey %@", appKey);
result(@(TRUE));
return;
}
appKey = key;
Solution 2:
Remove NSAssert from the dropbox library:
https://github.com/dropbox/dropbox-sdk-obj-c/blob/0d6f0bac2519f1e36b4f9c19c108eb50ca3a59be/Source/ObjectiveDropboxOfficial/Shared/Handwritten/DBClientsManager.m#L104
Metadata
Metadata
Assignees
Labels
No labels