Ios UIVideoEditorController在iPad上崩溃

Ios UIVideoEditorController在iPad上崩溃,ios,iphone,xcode,ipad,video,Ios,Iphone,Xcode,Ipad,Video,我正在尝试使用UIVideoEditorController编辑存储在应用程序文档目录中的视频。 它在iPhone(iOS 10.x)上运行,但在iPad(iOS 9.2)上崩溃 我可能需要补充一点,应用程序正在以横向模式运行。如文档中所述,UIVideoEditorController仅在纵向模式下运行。但既然它在iPhone上工作,我想这不应该是个问题吧 下面是我的工作(委托方法都已实现,但此处未提及): 这是崩溃日志: objc[6507]: EXCEPTIONS: throwing 0x

我正在尝试使用
UIVideoEditorController
编辑存储在应用程序文档目录中的视频。 它在iPhone(iOS 10.x)上运行,但在iPad(iOS 9.2)上崩溃

我可能需要补充一点,应用程序正在以横向模式运行。如文档中所述,
UIVideoEditorController
仅在纵向模式下运行。但既然它在iPhone上工作,我想这不应该是个问题吧

下面是我的工作(委托方法都已实现,但此处未提及):

这是崩溃日志:

objc[6507]: EXCEPTIONS: throwing 0x17648b30 (object 0x17648a90, a NSException)
objc[6507]: EXCEPTIONS: searching through frame [ip=0xffffffff sp=0x559900] for exception 0x17648b10
objc[6507]: EXCEPTIONS: searching through frame [ip=0x2 sp=0x55a880] for exception 0x17648b10
objc[6507]: EXCEPTIONS: unwinding through frame [ip=0xffffffff sp=0x559900] for exception 0x17648b10
objc[6507]: EXCEPTIONS: unwinding through frame [ip=0x2 sp=0x55a880] for exception 0x17648b10
objc[6507]: EXCEPTIONS: handling exception 0x17648b10 at 0x2236b2f9
objc[6507]: EXCEPTIONS: rethrowing current exception
objc[6507]: EXCEPTIONS: searching through frame [ip=0x6 sp=0x55a880] for exception 0x17648b10
objc[6507]: EXCEPTIONS: searching through frame [ip=0x3 sp=0x55aa20] for exception 0x17648b10
objc[6507]: EXCEPTIONS: catch(NSException)
objc[6507]: EXCEPTIONS: unwinding through frame [ip=0x6 sp=0x55a880] for exception 0x17648b10
objc[6507]: EXCEPTIONS: finishing handler
objc[6507]: EXCEPTIONS: unwinding through frame [ip=0xffffffff sp=0x55a880] for exception 0x17648b10
objc[6507]: EXCEPTIONS: unwinding through frame [ip=0x3 sp=0x55aa20] for exception 0x17648b10
objc[6507]: EXCEPTIONS: handling exception 0x17648b10 at 0x11175f
2017-04-02 14:17:20.281 myApp[6507:5048337] (
    0   CoreFoundation                      0x2245b933 <redacted> + 150
    1   libobjc.A.dylib                     0x21bf6e17 objc_exception_throw + 38
    2   CoreFoundation                      0x2245b861 <redacted> + 0
    3   PhotoLibrary                        0x2be83587 <redacted> + 186
    4   PhotoLibrary                        0x2be7f97f <redacted> + 1458
    5   PhotoLibrary                        0x2be9e897 <redacted> + 42
    6   UIKit                               0x269d6a1f <redacted> + 150
    7   UIKit                               0x26a94683 <redacted> + 38
    8   UIKit                               0x26a94575 <redacted> + 376
    9   UIKit                               0x26a93929 <redacted> + 96
    10  UIKit                               0x26a9355f <redacted> + 834
    11  UIKit                               0x26a6bbf1 <redacted> + 2048
    12  UIKit                               0x26d61485 <redacted> + 444
    13  UIKit                               0x26d437eb <redacted> + 114
    14  UIKit                               0x26a6b2db <redacted> + 370
    15  UIKit                               0x26faa5cd <redacted> + 112
    16  UIKit                               0x26faa1a3 <redacted> + 62
    17  UIKit                               0x269ef0e5 <redacted> + 568
    18  UIKit                               0x269eee87 <redacted> + 146
    19  UIKit                               0x26d2606d <redacted> + 1080
    20  UIKit                               0x26c7f4c9 <redacted> + 268
    21  UIKit                               0x26c8b7db <redacted> + 90
    22  UIKit                               0x269c9b1d <redacted> + 84
    23  CoreFoundation                      0x2241d6c9 <redacted> + 20
    24  CoreFoundation                      0x2241b9cd <redacted> + 280
    25  CoreFoundation                      0x2241bdff <redacted> + 958
    26  CoreFoundation                      0x2236b229 CFRunLoopRunSpecific + 520
    27  CoreFoundation                      0x2236b015 CFRunLoopRunInMode + 108
    28  GraphicsServices                    0x2395bac9 GSEventRunModal + 160
    29  UIKit                               0x26a3f189 UIApplicationMain + 144
    30  myApp                        0x0011173b main + 198
    31  libdyld.dylib                       0x22013873 <redacted> + 2
)
objc[6507]: EXCEPTIONS: finishing handler
objc[6507]: EXCEPTIONS: releasing completed exception 0x17648b30 (object 0x17648a90, a NSException)
objc[6507]:异常:抛出0x17648b30(对象0x17648a90,一个NSException)
objc[6507]:异常:在帧[ip=0xFFFFFF sp=0x559900]中搜索异常0x17648b10
objc[6507]:异常:在帧[ip=0x2 sp=0x55a880]中搜索异常0x17648b10
objc[6507]:异常:通过帧[ip=0xFFFFFF sp=0x559900]展开异常0x17648b10
objc[6507]:异常:通过帧[ip=0x2 sp=0x55a880]展开异常0x17648b10
objc[6507]:异常:在0x2236b2f9处处理异常0x17648b10
objc[6507]:异常:重新触发当前异常
objc[6507]:异常:在帧[ip=0x6 sp=0x55a880]中搜索异常0x17648b10
objc[6507]:异常:在帧[ip=0x3 sp=0x55aa20]中搜索异常0x17648b10
objc[6507]:异常:catch(NSException)
objc[6507]:异常:通过帧[ip=0x6 sp=0x55a880]展开异常0x17648b10
objc[6507]:异常:完成处理程序
objc[6507]:异常:通过帧[ip=0xFFFFFF sp=0x55a880]展开异常0x17648b10
objc[6507]:异常:通过帧[ip=0x3 sp=0x55aa20]展开异常0x17648b10
objc[6507]:异常:在0x11175f处处理异常0x17648b10
2017-04-02 14:17:20.281 myApp[6507:5048337](
0芯基础0x2245b933+150
1 libobjc.A.dylib 0x21bf6e17 objc_异常_抛出+38
2芯基础0x2245b861+0
3照片库0x2be83587+186
4照片库0x2be7f97f+1458
5照片库0x2be9e897+42
6 UIKit 0x269d6a1f+150
7 UIKit 0x26a94683+38
8 UIKit 0x26a94575+376
9 UIKit 0x26a93929+96
10 UIKit 0x26a9355f+834
11 UIKit 0x26a6bbf1+2048
12 UIKit 0x26d61485+444
13 UIKit 0x26d437eb+114
14 UIKit 0x26a6b2db+370
15 UIKit 0x26faa5cd+112
16 UIKit 0x26faa1a3+62
17 UIKit 0x269ef0e5+568
18 UIKit 0x269eee87+146
19 UIKit 0x26d2606d+1080
20 UIKit 0x26c7f4c9+268
21 UIKit 0x26c8b7db+90
22 UIKit 0x269c9b1d+84
23芯基础0x2241d6c9+20
24芯基础0x2241b9cd+280
25芯基础0x2241bdff+958
26 CoreFoundation 0x2236b229 CFRunLoopRunSpecific+520
27 CoreFoundation 0x2236b015 CFRUNLOOPSRUNINMODE+108
28图形服务0x2395bac9 GSEventRunModal+160
29 UIKit 0x26a3f189 UIApplicationMain+144
30 myApp 0x0011173b主管道+198
31 libdyld.dylib 0x22013873+2
)
objc[6507]:异常:完成处理程序
objc[6507]:异常:释放已完成的异常0x17648b30(对象0x17648a90,一个NSException)

有什么想法吗?

以下是解决方案:

UIVideoEditorController *vec = [[UIVideoEditorController alloc] init];

    vec.delegate = self;
    vec.videoPath = filePath;
    vec.videoQuality = UIImagePickerControllerQualityTypeHigh;

    if ( UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad ){
        vec.modalPresentationStyle = UIModalPresentationPopover;
        vec.popoverPresentationController.sourceView = vec.view;
    }

    NSLog(@"Editing video %@", filePath);

    if ( [UIVideoEditorController canEditVideoAtPath:filePath] )
    {
        [self presentViewController:vec animated:YES completion:nil];
    }
    else
    {
        NSLog( @"can't edit video at %@", filePath );
    }

编辑需要在iPad上的popover中呈现。否则会出现错误。

以下是解决此问题的方法:

UIVideoEditorController *vec = [[UIVideoEditorController alloc] init];

    vec.delegate = self;
    vec.videoPath = filePath;
    vec.videoQuality = UIImagePickerControllerQualityTypeHigh;

    if ( UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad ){
        vec.modalPresentationStyle = UIModalPresentationPopover;
        vec.popoverPresentationController.sourceView = vec.view;
    }

    NSLog(@"Editing video %@", filePath);

    if ( [UIVideoEditorController canEditVideoAtPath:filePath] )
    {
        [self presentViewController:vec animated:YES completion:nil];
    }
    else
    {
        NSLog( @"can't edit video at %@", filePath );
    }

编辑需要在iPad上的popover中呈现。否则您将得到一个错误。

我将尽快添加最终答案。首先,我忘了向编辑器控制器添加videoPath和几乎所有属性。然后我不得不在iPad上把它作为popover控制器展示。现在它工作了。。。这是一个“duh”时刻……我会尽快添加最终答案。首先,我忘了向编辑器控制器添加videoPath和几乎所有属性。然后我不得不在iPad上把它作为popover控制器展示。现在它工作了。。。那是一个«duh»时刻。。。