2017-04-02 1 views
0

UIVideoEditorController을 사용하여 앱의 문서 디렉토리에 저장된 비디오를 편집하려고합니다. iPhone (iOS 10.x)에서는 작동하지만 iPad에서는 충돌합니다 (iOS 9.2).iPad에서 UIVideoEditorController가 충돌 함

가로 모드로 실행중인 앱을 추가해야 할 수도 있습니다. 문서에 명시된 바와 같이 UIVideoEditorController은 세로 모드에서만 실행됩니다. 하지만 아이폰에서 작동하고 있기 때문에 이것이 문제가되어서는 안된다. 여기

는 내가 무엇을 (위임-방법 모두 구현하지만, 여기에 언급되지 않음) :

NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); 
    NSString *documentsDirectory = [paths objectAtIndex:0]; 
NSString *filePath = [NSString stringWithString: [documentsDirectory stringByAppendingPathComponent:[NSString stringWithFormat: @"myMovie_%li.MOV", (long)self.editMovie]]]; 

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

vec.delegate = self; 

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

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

그리고이 충돌 - 로그입니다 :

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) 

어떤 아이디어?

+0

최대한 빨리 최종 답변을 추가하겠습니다. 먼저, videoPath와 거의 모든 속성을 Editor-Controller에 추가하는 것을 잊었습니다. 그런 다음 iPad에서 팝업 제어기로 제시해야했습니다. 이제는 작동합니다 ... 그게 다야? - 순간이야 ... – Swissdude

답변

1

다음은 이에 대한 해결책 :

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); 
    } 

편집기는 아이 패드에 팝 오버에 제시 될 필요가있다. 그렇지 않으면 오류가 발생합니다.