我在 Ionic 中使用以下插件来可视化图像:@ionic-native/photo-viewer。
调用可视化方法时:
PhotoViewer.show('http://my_site.com/my_image.jpg', 'Optional Title', {share: true});
一切都在 Android 设备/模拟器上按预期工作。但是,当尝试在使用 iOS 设备/模拟器时调用相同的方法时,应用程序甚至在图像可视化之前就完全崩溃了。这些是应用程序崩溃时的日志:
2018-07-30 21:20:05.706360+0100 MyApp[23373:2960263] THREAD WARNING:
['PhotoViewer'] took '25.631104' ms. Plugin should use a background thread.
2018-07-30 21:20:06.442060+0100 MyApp[23373:2961920] * Assertion failure in -[UIDocumentInteractionController setURL:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/UIKit_Sim/UIKit-3698.54.4/Source/DocumentInteraction/UIDocumentInteractionController.m:183
2018-07-30 21:20:06.453089+0100 MyApp[23373:2961920] * Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'UIDocumentInteractionController: invalid scheme https. Only the file scheme is supported.'
* First throw call stack:
(
0 CoreFoundation 0x00000001115b71e6 __exceptionPreprocess + 294
1 libobjc.A.dylib 0x00000001104b8031 objc_exception_throw + 48
2 CoreFoundation 0x00000001115bc472 +[NSException raise:format:arguments:] + 98
3 Foundation 0x000000010ea75652 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 193
4 UIKit 0x000000010d01db3e -[UIDocumentInteractionController setURL:] + 702
5 UIKit 0x000000010d01d140 -[UIDocumentInteractionController initWithURL:] + 130
6 UIKit 0x000000010d01d0a2 +[UIDocumentInteractionController interactionControllerWithURL:] + 65
7 MyApp 0x000000010b539420 -[PhotoViewer setupDocumentControllerWithURL:andTitle:] + 160
8 MyApp 0x000000010b53a25b __20-[PhotoViewer show:]_block_invoke + 347
9 libdispatch.dylib 0x0000000112b0b7ab _dispatch_call_block_and_release + 12
10 libdispatch.dylib 0x0000000112b0c7ec _dispatch_client_callout + 8
11 libdispatch.dylib 0x0000000112b11619 _dispatch_queue_override_invoke + 1451
12 libdispatch.dylib 0x0000000112b1836c _dispatch_root_queue_drain + 664
13 libdispatch.dylib 0x0000000112b18076 _dispatch_worker_thread3 + 132
14 libsystem_pthread.dylib 0x0000000113037169 _pthread_wqthread + 1387
15 libsystem_pthread.dylib 0x0000000113036be9 start_wqthread + 13
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)
以前有没有人遇到过这个问题,或者可能知道如何解决这个问题?我已将问题发布在插件存储库的“问题”部分,但是,由于创建者没有时间支持他的插件,我想在这里寻求帮助。有谁知道导致问题的原因以及如何解决?