我在我的React Native项目中使用react-native-background-downloader。单击一个按钮后,将在Documents.dir(RNFetchBlob)中开始下载。这是Android OS中的行为。但是在iOS中,我一点击下载按钮。该应用程序崩溃。 我认为这与url方案有关。我将网址更改为硬编码的网址,例如Play Store APK。但是我曾经(想要)传递的URL(哪个索引URL)竟然使我的应用程序崩溃
完整日志:- SLink_ios [11757:276497]后台下载的无效URL方案:(空)。有效的方案是http或https 2019-01-29 00:48:35.940985 + 0530 SLink_ios [11757:276497]任务<81F6DEDF-F785-48FA-979C-5C21382B3D14>。<1>加载失败,错误为Error Domain = NSURLErrorDomain Code = -1002“不支持的URL” UserInfo = {_ NSURLErrorRelatedURLSessionTaskErrorKey =(“” BackgroundDownloadTask <81F6DEDF-F785-48FA-979C-5C21382B3D14>。<1>“)),NSLocalizedDescription =不受支持的URL,_NSURLErrorFailingURLSessionTaskErrorKey = BackgroundDownloadTask -81C6C21DE >。<1>} [-1002] 2019-01-29 00:48:35.943 [info] [tid:main] [RCTImageView.m:422]重新加载图像http://localhost:8081/assets/src/Assets/download.png?platform=ios&hash=9dde24daa36aede3432b0ac881695f75为大小{36,36} 2019 -01-29 00:48:35.942703 + 0530 SLink_ios [11757:276357]以大小{36,36}重新加载图像http://localhost:8081/assets/src/Assets/download.png?platform=ios&hash=9dde24daa36aede3432b0ac881695f75 2019-01-29 00:48:35.943100 + 0530 SLink_ios [11757:276473]任务。<368>加载失败,错误为Error Domain = NSURLErrorDomain代码= -999“已取消” UserInfo = {NSErrorFailingURLStringKey = http://localhost:8081/assets/src/Assets/spinner.gif?platform=ios&hash=2f2ad9512c7ad4ea794d3a5d6adbd69e,NSErrorFailingURLKey = http://localhost:8081/assets/src/Assets/spinner.gif?platform=ios&hash=2f2ad9512c7ad4ea794d3a5d6adbd69e,_ NSURLErrorRelatedURLSessionTaskErrorKey =(“ LocalDataTask。<368>”), _NSURLErrorFailingURLSe ssionTaskErrorKey = LocalDataTask。<368>,NSLocalizedDescription = cancelled} [-999] 2019-01-29 00:48:35.943343 + 0530 SLink_ios [11757:276432]任务。<368>已完成,错误-代码:-999 2019-01 -29 00:48:35.954 [info] [tid:com.facebook.react.JavaScript]不支持的URL 2019-01-29 00:48:35.954103 + 0530 SLink_ios [11757:276480]不支持的URL 2019-01-29 00: 48:35.980064 + 0530 SLink_ios [11757:276357]要在此设备上获取测试广告,请设置:request.testDevices = @ [kGADSimulatorID]; 2019-01-29 00:48:35.999636 + 0530 SLink_ios [11757:276497] *由于未捕获的异常'NSInvalidArgumentException'而终止应用程序,原因:'*-[NSDictionaryM removeObjectForKey:]:键不能为零'***第一次抛出调用堆栈:(0的CoreFoundation 0x000000010e93b1bb __exceptionPreprocess + 331 1 libobjc.A.dylib 0x000000010dd34735 objc_exception_throw + 48 2的CoreFoundation 0x000000010e8874ec _CFThrowFormattedException + 194 3的CoreFoundation 0x000000010e9acd45 - [__ NSDictionaryM removeObjectForKey:] + 213 4 SLink_ios 0x0000000107f1cffc - [RNBackgroundDownloader removeTaskFromMap:] + 268个5 SLink_ios 0x0000000107f1ffdc - [RNBackgroundDownloader URLSession:任务:didCompleteWithError:] + 572 6 CFNetwork的0x0000000109952342 __51- [NSURLSession delegate_task:didCompleteWithError:] _ block_invoke.241 + 284 7基金会0x000000010ae07f9e __NSBLOCKOPERATION_IS_CALLING_OUT_TO_A_BLOCK + 7 8基础0x000000010ae07ea5 - [NSBlockOperation主] + 68 9基金会0x000000010ae04c14 - [__NSOperationInternal _st技术:] + 689 10基金会0x000000010ae0ac4b __NSOQSchedule_f + 227 11 libdispatch.dylib 0x000000010fa41595 _dispatch_call_block_and_release + 12 12 libdispatch.dylib 0x000000010fa42602 _dispatch_client_callout + 8 13 libdispatch.dylib 0x000000010fa4554d _dispatch_continuation_pop + 565 14 libdispatch.dylib 0x000000010fa44927 _dispatch_async_redirect_invoke + 859 15 libdispatch.dylib 0x000000010fa5300a _dispatch_root_queue_drain + 351 16 libdispatch.dylib 0x000000010fa539af _dispatch_worker_thread2 + 130 17 libsystem_pthread.dylib 0x000000010fe266dd _pthread_wqthread + 619 18 libsystem_pthread.dylib 0x000000010fe26405 start_wqthread + 13)libc ++ abi.dylib:以异常终止
我不知道回答该问题需要哪些文件/屏幕截图。我正在上传我认为足够的文件。如果需要其他任何信息,我很乐意提供。
以下是必需的文件:- here
我尝试了以下操作:
已清理并重建项目。
删除了模拟器的所有内容和设置。
答案 0 :(得分:0)
编码对我有用的网址:) encodeURI(url)