Open sunkaigoon opened 4 years ago
return await FlutterDownloader.enqueue( url: url, savedDir: savePath ?? _defaultSavePath, showNotification: false, openFileFromNotification: false, // fileName: fileName, );
return await FlutterDownloader.enqueue(
url: url,
savedDir: savePath ?? _defaultSavePath,
showNotification: false,
openFileFromNotification: false,
// fileName: fileName,
);
No fileName when enqueue. Then FlutterDownloaderPlugin.m: 302
- (NSURL*)fileUrlFromDict:(NSDictionary*)dict { NSString *savedDir = dict[KEY_SAVED_DIR]; NSString *filename = dict[KEY_FILE_NAME]; if (debug) { NSLog(@"savedDir: %@", savedDir); NSLog(@"filename: %@", filename); } NSURL *savedDirURL = [NSURL fileURLWithPath:savedDir]; return [savedDirURL URLByAppendingPathComponent:filename]; }
- (NSURL*)fileUrlFromDict:(NSDictionary*)dict
{
NSString *savedDir = dict[KEY_SAVED_DIR];
NSString *filename = dict[KEY_FILE_NAME];
if (debug) {
NSLog(@"savedDir: %@", savedDir);
NSLog(@"filename: %@", filename);
}
NSURL *savedDirURL = [NSURL fileURLWithPath:savedDir];
return [savedDirURL URLByAppendingPathComponent:filename];
[savedDirURL URLByAppendingPathComponent:filename] filename is NSNull.
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSNull hasSuffix:]: unrecognized selector sent to instance 0x7fff8062d9d0' *** First throw call stack: ( 0 CoreFoundation 0x00007fff23e3cf0e __exceptionPreprocess + 350 1 libobjc.A.dylib 0x00007fff50ba89b2 objc_exception_throw + 48 2 CoreFoundation 0x00007fff23e5dc34 -[NSObject(NSObject) doesNotRecognizeSelector:] + 132 3 CoreFoundation 0x00007fff23e4190c ___forwarding___ + 1436 4 CoreFoundation 0x00007fff23e43bf8 _CF_forwarding_prep_0 + 120 5 Foundation 0x00007fff25979cdb -[NSURL(NSURLPathUtilities) URLByAppendingPathComponent:] + 69 6 flutter_downloader 0x00000001119083b2 -[FlutterDownloaderPlugin fileUrlFromDict:] + 242 7 flutter_downloader 0x000000011190e4fb -[FlutterDownloaderPlugin removeMethodCall:result:] + 859 8 flutter_downloader 0x000000011190f65d -[FlutterDownloaderPlugin handleMethodCall:result:] + 1757 9 Flutter 0x000000010f745b1f __45-[FlutterMethodChannel setMethodCallHandler:]_block_invoke + 104 10 Flutter 0x000000010f6d4762 _ZNK7flutter21PlatformMessageRouter21HandlePlatformMessageEN3fml6RefPtrINS_15PlatformMessageEEE + 166 11 Flutter 0x000000010f6d88ba _ZN7flutter15PlatformViewIOS21HandlePlatformMessageEN3fml6RefPtrINS_15PlatformMessageEEE + 38 12 Flutter 0x000000010f73f7fb _ZNSt3__110__function6__funcIZN7flutter5Shell29OnEngineHandlePlatformMessageEN3fml6RefPtrINS2_15PlatformMessageEEEE4$_32NS_9allocatorIS8_EEFvvEEclEv + 57 13 Flutter 0x000000010f6e93a7 _ZN3fml15MessageLoopImpl10FlushTasksENS_9FlushTypeE + 117 14 Flutter 0x000000010f6ee2f4 _ZN3fml17MessageLoopDarwin11OnTimerFireEP16__CFRunLoopTimerPS0_ + 26 15 CoreFoundation 0x00007fff23da14b4 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 20 16 CoreFoundation 0x00007fff23da114e __CFRunLoopDoTimer + 1038 17 CoreFoundation 0x00007fff23da07aa __CFRunLoopDoTimers + 282 18 CoreFoundation 0x00007fff23d9b3fe __CFRunLoopRun + 1950 19 CoreFoundation 0x00007fff23d9a944 CFRunLoopRunSpecific + 404 20 GraphicsServices 0x00007fff38ba6c1a GSEventRunModal + 139 21 UIKitCore 0x00007fff48c8b9ec UIApplicationMain + 1605 22 Runner 0x000000010e383fdb main + 75 23 libdyld.dylib 0x00007fff51a231fd start + 1 24 ??? 0x0000000000000001 0x0 + 1 )
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSNull hasSuffix:]: unrecognized selector sent to instance 0x7fff8062d9d0'
*** First throw call stack:
(
0 CoreFoundation 0x00007fff23e3cf0e __exceptionPreprocess + 350
1 libobjc.A.dylib 0x00007fff50ba89b2 objc_exception_throw + 48
2 CoreFoundation 0x00007fff23e5dc34 -[NSObject(NSObject) doesNotRecognizeSelector:] + 132
3 CoreFoundation 0x00007fff23e4190c ___forwarding___ + 1436
4 CoreFoundation 0x00007fff23e43bf8 _CF_forwarding_prep_0 + 120
5 Foundation 0x00007fff25979cdb -[NSURL(NSURLPathUtilities) URLByAppendingPathComponent:] + 69
6 flutter_downloader 0x00000001119083b2 -[FlutterDownloaderPlugin fileUrlFromDict:] + 242
7 flutter_downloader 0x000000011190e4fb -[FlutterDownloaderPlugin removeMethodCall:result:] + 859
8 flutter_downloader 0x000000011190f65d -[FlutterDownloaderPlugin handleMethodCall:result:] + 1757
9 Flutter 0x000000010f745b1f __45-[FlutterMethodChannel setMethodCallHandler:]_block_invoke + 104
10 Flutter 0x000000010f6d4762 _ZNK7flutter21PlatformMessageRouter21HandlePlatformMessageEN3fml6RefPtrINS_15PlatformMessageEEE + 166
11 Flutter 0x000000010f6d88ba _ZN7flutter15PlatformViewIOS21HandlePlatformMessageEN3fml6RefPtrINS_15PlatformMessageEEE + 38
12 Flutter 0x000000010f73f7fb _ZNSt3__110__function6__funcIZN7flutter5Shell29OnEngineHandlePlatformMessageEN3fml6RefPtrINS2_15PlatformMessageEEEE4$_32NS_9allocatorIS8_EEFvvEEclEv + 57
13 Flutter 0x000000010f6e93a7 _ZN3fml15MessageLoopImpl10FlushTasksENS_9FlushTypeE + 117
14 Flutter 0x000000010f6ee2f4 _ZN3fml17MessageLoopDarwin11OnTimerFireEP16__CFRunLoopTimerPS0_ + 26
15 CoreFoundation 0x00007fff23da14b4 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 20
16 CoreFoundation 0x00007fff23da114e __CFRunLoopDoTimer + 1038
17 CoreFoundation 0x00007fff23da07aa __CFRunLoopDoTimers + 282
18 CoreFoundation 0x00007fff23d9b3fe __CFRunLoopRun + 1950
19 CoreFoundation 0x00007fff23d9a944 CFRunLoopRunSpecific + 404
20 GraphicsServices 0x00007fff38ba6c1a GSEventRunModal + 139
21 UIKitCore 0x00007fff48c8b9ec UIApplicationMain + 1605
22 Runner 0x000000010e383fdb main + 75
23 libdyld.dylib 0x00007fff51a231fd start + 1
24 ??? 0x0000000000000001 0x0 + 1
)
How can I get the original file name.
return await FlutterDownloader.enqueue(
url: url,
savedDir: savePath ?? _defaultSavePath,
showNotification: false,
openFileFromNotification: false,
// fileName: fileName,
);
No fileName when enqueue. Then FlutterDownloaderPlugin.m: 302
- (NSURL*)fileUrlFromDict:(NSDictionary*)dict
{
NSString *savedDir = dict[KEY_SAVED_DIR];
NSString *filename = dict[KEY_FILE_NAME];
if (debug) {
NSLog(@"savedDir: %@", savedDir);
NSLog(@"filename: %@", filename);
}
NSURL *savedDirURL = [NSURL fileURLWithPath:savedDir];
return [savedDirURL URLByAppendingPathComponent:filename];
}
[savedDirURL URLByAppendingPathComponent:filename] filename is NSNull.
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSNull hasSuffix:]: unrecognized selector sent to instance 0x7fff8062d9d0'
*** First throw call stack:
(
0 CoreFoundation 0x00007fff23e3cf0e __exceptionPreprocess + 350
1 libobjc.A.dylib 0x00007fff50ba89b2 objc_exception_throw + 48
2 CoreFoundation 0x00007fff23e5dc34 -[NSObject(NSObject) doesNotRecognizeSelector:] + 132
3 CoreFoundation 0x00007fff23e4190c ___forwarding___ + 1436
4 CoreFoundation 0x00007fff23e43bf8 _CF_forwarding_prep_0 + 120
5 Foundation 0x00007fff25979cdb -[NSURL(NSURLPathUtilities) URLByAppendingPathComponent:] + 69
6 flutter_downloader 0x00000001119083b2 -[FlutterDownloaderPlugin fileUrlFromDict:] + 242
7 flutter_downloader 0x000000011190e4fb -[FlutterDownloaderPlugin removeMethodCall:result:] + 859
8 flutter_downloader 0x000000011190f65d -[FlutterDownloaderPlugin handleMethodCall:result:] + 1757
9 Flutter 0x000000010f745b1f __45-[FlutterMethodChannel setMethodCallHandler:]_block_invoke + 104
10 Flutter 0x000000010f6d4762 _ZNK7flutter21PlatformMessageRouter21HandlePlatformMessageEN3fml6RefPtrINS_15PlatformMessageEEE + 166
11 Flutter 0x000000010f6d88ba _ZN7flutter15PlatformViewIOS21HandlePlatformMessageEN3fml6RefPtrINS_15PlatformMessageEEE + 38
12 Flutter 0x000000010f73f7fb _ZNSt3__110__function6__funcIZN7flutter5Shell29OnEngineHandlePlatformMessageEN3fml6RefPtrINS2_15PlatformMessageEEEE4$_32NS_9allocatorIS8_EEFvvEEclEv + 57
13 Flutter 0x000000010f6e93a7 _ZN3fml15MessageLoopImpl10FlushTasksENS_9FlushTypeE + 117
14 Flutter 0x000000010f6ee2f4 _ZN3fml17MessageLoopDarwin11OnTimerFireEP16__CFRunLoopTimerPS0_ + 26
15 CoreFoundation 0x00007fff23da14b4 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 20
16 CoreFoundation 0x00007fff23da114e __CFRunLoopDoTimer + 1038
17 CoreFoundation 0x00007fff23da07aa __CFRunLoopDoTimers + 282
18 CoreFoundation 0x00007fff23d9b3fe __CFRunLoopRun + 1950
19 CoreFoundation 0x00007fff23d9a944 CFRunLoopRunSpecific + 404
20 GraphicsServices 0x00007fff38ba6c1a GSEventRunModal + 139
21 UIKitCore 0x00007fff48c8b9ec UIApplicationMain + 1605
22 Runner 0x000000010e383fdb main + 75
23 libdyld.dylib 0x00007fff51a231fd start + 1
24 ??? 0x0000000000000001 0x0 + 1
)