0

I am trying to import files from sdCard using sdcard reader on ipad. While importing the mts files from the card, i convert them to mov format and save it to the documents directory of the application. It completely converts the files if i dont call below mentioned function to get date. When i call this function to get creation date of the video file while importing. It crashes and gives the following stack trace....

*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'couldn't fork: errno 35'
*** Call stack at first throw:
(
    0   CoreFoundation                      0x32fba64f __exceptionPreprocess + 114
    1   libobjc.A.dylib                     0x35992c5d objc_exception_throw + 24
    2   CoreFoundation                      0x32fba491 +[NSException raise:format:arguments:] + 68
    3   CoreFoundation                      0x32fba4cb +[NSException raise:format:] + 34
    4   Foundation                          0x3582be8f -[NSConcreteTask launchWithDictionary:] + 2138
    5   Foundation                          0x3582af57 -[NSConcreteTask launch] + 22
    6   IRVideoEditor                       0x0002f917 +[IRVideoManager getCreatedDate:] + 358
    7   IRVideoEditor                       0x0002f65d +[IRVideoManager duplicateExists:] + 240
    8   IRVideoEditor                       0x0002d6c9 -[IRVideoEncoder wrapVideos] + 752
    9   IRVideoEditor                       0x00016d27 -[ImportVideoViewController importVideo] + 170
    10  Foundation                          0x357b0389 -[NSThread main] + 44
    11  Foundation                          0x358225cd __NSThread__main__ + 972
    12  libsystem_c.dylib                   0x36539311 _pthread_start + 248
    13  libsystem_c.dylib                   0x3653abbc start_wqthread + 0
)
terminate called after throwing an instance of 'NSException'

bellow is the code, I am using to get date using nstask

NSPipe *pipe = [NSPipe pipe];

    task = [[NSTask alloc] init];


    [task setLaunchPath: @"/bin/sh"];


    NSArray *arguments = [NSArray arrayWithObjects:@"-c", [NSString stringWithFormat:@"stat -c %%y %@", filePath], nil]; // iPad stat

    [task setArguments: arguments];

    [task setStandardOutput:pipe];

    [task setStandardError:[NSPipe pipe]];

// [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(taskExited:) name:NSTaskDidTerminateNotification object:task]; [task launch]; //[task waitUntilExit];

    NSString * date = [[[NSString alloc] initWithData:[[pipe fileHandleForReading] availableData] encoding:NSASCIIStringEncoding] autorelease];
    return date;
4
  • I'm surprised you don't get errno 1 "Operation not permitted".
    – trojanfoe
    Mar 12, 2013 at 16:37
  • any suggestions? trojanfoe Mar 13, 2013 at 8:12
  • Yes; you cannot start processes under iOS and if all you want is file information I don't see why you would anyway.
    – trojanfoe
    Mar 13, 2013 at 8:58
  • We need creation time of the clips to resync them according to that time !! that information can be get while importing. So i need to get that time !! i am using nstask to get file size too and that is working fine Mar 13, 2013 at 10:51

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.