Представление опции Share, работающей только тогда, когда включен исполняемый файл отладки - iOS - React NativeIOS

Программируем под IOS
Ответить
Anonymous
 Представление опции Share, работающей только тогда, когда включен исполняемый файл отладки - iOS - React Native

Сообщение Anonymous »

В ios встроенная функция общего доступа к приложениям реализована в ios. Контроллер UIDocumentInteraction используется для отображения окна общего доступа.
Приведенный ниже код написан как селектор действий для UIBarButton.

Код: Выделить всё

@objc fileprivate func shareTapped(_ sender: UIBarButtonItem) {
if let pageURL = extractPageFromDocument(document, forPageNumber: Int(pageIndex), withName: "share-report-page.pdf") {
documentInteractionController.url = pageURL
documentInteractionController.presentOptionsMenu(from: sender, animated: true)
}
}
Код работает отлично, когда исполняемый файл отладки включен в схеме xcode.
Когда исполняемый файл отладки включен, отображается этот экран. >
Тот же код вызывает сбой при запуске приложения с отключенным исполняемым файлом отладки в xcode. Журнал сбоев приведен ниже.

Код: Выделить всё

*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[SHSheetPresenter applyOptionsOnWillMoveToParentViewController:]:  unrecognized selector sent to instance 0x6000038bea00'
*** First throw call stack:
(
0   CoreFoundation                      0x0000000114423531 __exceptionPreprocess + 242
1   libobjc.A.dylib                     0x0000000110ea37e8 objc_exception_throw + 48
2   CoreFoundation                      0x0000000114438643 +[NSObject(NSObject) instanceMethodSignatureForSelector:] + 0
3   CoreFoundation                      0x0000000114427cc4 ___forwarding___ + 1459
4   CoreFoundation                      0x0000000114429ec8 _CF_forwarding_prep_0 + 120
5   OneViewNew                          0x00000001059161b5 -[UIViewController(LayoutProtocol)  willMoveToParentViewController:] + 133
6   UIKitCore                           0x0000000137be2b6c -[UIViewController _addChildViewController:performHierarchyCheck:notifyWillMove:] + 691
7   UIKitCore                           0x0000000137afde44 -[UINavigationController pushViewController:transition:forceImmediate:] + 1782
8   UIKitCore                           0x0000000137afd594 -[UINavigationController pushViewController:animated:] + 992
9   ShareSheet                          0x000000012ae7fa2a -[SHSheetRouter presentMainViewController:withNavigationControllerSupport:] + 252
10  ShareSheet                          0x000000012ae33707 -[SHSheetPresenter prepareViewIfNeeded] + 714
11  ShareSheet                          0x000000012ae1a7ca -[UIActivityViewController viewDidLoad] + 110
12  UIKitCore                           0x0000000137bd7e1a -[UIViewController _sendViewDidLoadWithAppearanceProxyObjectTaggingEnabled] + 80
13  UIKitCore                           0x0000000137bddf12 -[UIViewController loadViewIfRequired] + 1342
14  UIKitCore                           0x0000000137bde2f9 -[UIViewController view] + 27
15  UIKitCore                           0x0000000137bf690c -[UIViewController _setPresentationController:] + 92
16  UIKitCore                           0x0000000137bee745 -[UIViewController _presentViewController:modalSourceViewController:presentationController:animationController:interactionController:completion:] + 1472
17  UIKitCore                           0x0000000137bf20b1 -[UIViewController _presentViewController:withAnimationController:completion:] + 4488
18  CoreFoundation                      0x000000011442a15c __invoking___ + 140
19  CoreFoundation                      0x0000000114427483 -[NSInvocation invoke] + 302
20  UIKitCore                           0x0000000137bebd8e -[UIViewController _endDelayingPresentation] + 441
21  ShareSheet                          0x000000012ae1b5f2 -[UIActivityViewController _endDelayingPresentation] + 229
22  ShareSheet                          0x000000012ae0a656 -[SHSheetScene scene:didReceiveActions:] + 589
23  FrontBoard                          0x000000012d082630 -[FBSceneObserver scene:didReceiveActions:] + 104
24  FrontBoard                          0x000000012d080457 __57-[FBSceneWorkspace scene:didReceiveActions:forExtension:]_block_invoke + 1212
25  BaseBoard                           0x000000011f19770c -[BSEventQueue _processNextEvent] + 294
26  BaseBoard                           0x000000011f197b5d -[BSEventQueue executeOrInsertEvents:atPosition:] + 778
27  BaseBoard                           0x000000011f1977fc -[BSEventQueue executeOrInsertEvent:atPosition:] + 112
28  FrontBoard                          0x000000012d07c829 -[FBSceneWorkspace _executeNextIdleEventIfAppropriate] + 303
29  FrontBoard                          0x000000012d07c6ed -[FBSceneWorkspace _executeEventWhenIdle:] + 98
30  FrontBoard                          0x000000012d07fe55 -[FBSceneWorkspace scene:didReceiveActions:forExtension:] + 684
31  libdispatch.dylib                   0x0000000114f643ec _dispatch_call_block_and_release + 12
32  libdispatch.dylib                   0x0000000114f656d8 _dispatch_client_callout + 8
33  libdispatch.dylib                   0x0000000114f7448c _dispatch_main_queue_drain + 1420
34  libdispatch.dylib                   0x0000000114f73ef2 _dispatch_main_queue_callback_4CF + 31
35  CoreFoundation                      0x000000011437faf4 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
36  CoreFoundation                      0x000000011437a42f __CFRunLoopRun + 2463
37  CoreFoundation                      0x00000001143796ad CFRunLoopRunSpecific + 557
38  GraphicsServices                    0x000000011f92e08f GSEventRunModal + 137
39  UIKitCore                           0x00000001385c8ad1 -[UIApplication _run] + 972
40  UIKitCore                           0x00000001385cd551 UIApplicationMain + 123
41  OneViewNew                          0x0000000104d5cf1f main + 63
42  dyld                                0x00000001103023e0 start_sim + 10
43  ???                                 0x0000000207bf8345 0x0 + 8719926085
)
libc++abi: terminating due to uncaught exception of type NSException
Перед сбоем попробовал отладку с точкой останова исключения и отладчиком, нажавшим на указанное ниже место в «UIViewController+LayoutProtocol».
(https://i. sstatic.net/QG9FrjnZ.png)
Значение Self.presenter здесь: и параметрsolveOptions равен нулю.

Подробнее здесь: https://stackoverflow.com/questions/791 ... bled-ios-r
Ответить

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

Вернуться в «IOS»