2

我正在用目标 C 代码编写 iOS 应用程序,这是用户点击 barItem 上的按钮时的操作方法

- (void)tappedInToolbar:(MyToolbar *)toolbar shareButton:(UIButton *)button {
   
     UIActivityViewController *activityController = [[UIActivityViewController alloc]
                                      initWithActivityItems:@[self, document.fileURL] 
                                      applicationActivities:nil];
      
     activityController.modalPresentationStyle = UIModalPresentationPopover;
    
     [self presentViewController:activityController animated:YES completion:nil];
    
     UIPopoverPresentationController *popController = [activityController popoverPresentationController];
      
     popController.permittedArrowDirections = UIPopoverArrowDirectionAny;
      
     popController.sourceView = button;
     
 }

该应用程序能够成功呈现活动控制器,我可以选择许多系统应用程序来共享我的文件,例如“Airdrop”邮件、Notes 等;但是,每当我点击消息以共享文件时,应用程序都会因此堆栈跟踪而崩溃。

如果有人知道如何解决此问题,请分享,将不胜感激。

1   
IOSurface
IOSurfaceClientGetPixelFormat + 0
2   
QuartzCore
CA::CG::IOSurfaceContext::create_delegate(CGIOSurfaceContextInfo const*, __CFDictionary const*) + 544
3   
CoreGraphics
CGIOSurfaceContextCreate + 212
4   
BaseBoardUI
BSUISurfaceWithColorSpaceAndDrawBlock + 536
5   
SpringBoardFoundation
SBFCreateIOSurfaceForImage + 1092
6   
ChatKit
-[CKRemoteItemForSending _setPreviewUIImage:] + 80
7   
ChatKit
__46-[CKRemoteItemForSending beginPreviewCreation]_block_invoke + 208
8   
Foundation
__NSBLOCKOPERATION_IS_CALLING_OUT_TO_A_BLOCK__ + 20
9   
Foundation
-[NSBlockOperation main] + 100
10  
Foundation
__NSOPERATION_IS_INVOKING_MAIN__ + 20
11  
Foundation
-[NSOperation start] + 736
12  
Foundation
__NSOPERATIONQUEUE_IS_STARTING_AN_OPERATION__ + 20
13  
Foundation
__NSOQSchedule_f + 180
14  
libdispatch.dylib
_dispatch_block_async_invoke2 + 140
15  
libdispatch.dylib
_dispatch_client_callout + 16
4

0 回答 0