2011-08-09 57 views
1

我是mac開發新手。我必須通過命令進行iPhone備份。有一個關於這個網站的解釋(http://keepmurmuring.blogspot.com/2009/06/iphone-backup-informationnote.html)。我嘗試使用參數執行腳本「System/Library/PrivateFrameworks/MobileDevice.framework/Resources/AppleMobileDeviceHelper.app/Contents/Resources/AppleMobileBackup」。但是我無法訪問這個路徑並且出現錯誤「啓動路徑不可訪問」。任何人都可以幫助我訪問路徑並完成我的任務。從Mac執行腳本

NSString *_filename [email protected]"System/Library/PrivateFrameworks/MobileDevice.framework/Resources/AppleMobileDeviceHelper.app/Contents/Resources/AppleMobileBackup"; 
    NSArray *arguments = [NSArray arrayWithObjects: @"./ambackup", 
          @"--backup", @"--target", @"BE1F74EEB98E14D426665D54105DE27821A6C0FE", nil]; 
    NSTask *task = [[NSTask alloc] init]; 
    NSPipe *pipe = [NSPipe pipe]; 
    NSFileHandle *readHandle = [pipe fileHandleForReading]; 
    NSData *temp = nil; 


    NSMutableData *_data = [[NSMutableData alloc] init]; 

    [task setLaunchPath:_filename]; 
    [task setArguments:arguments]; 
    [task setStandardOutput:pipe]; 
    [task launch]; 

    while ((temp = [readHandle availableData]) && [temp length]) 
    { 
     [_data appendData:temp]; 
    } 


    [task release]; 

回答

1

你缺少你的文件名路徑的斜線

NSString *_filename = @"System/Library/PrivateFrameworks/MobileDevice.framework/Resources/AppleMobileDeviceHelper.app/Contents/Resources/AppleMobileBackup"; 

應該是:

NSString *_filename = @"/System/Library/PrivateFrameworks/MobileDevice.framework/Resources/AppleMobileDeviceHelper.app/Contents/Resources/AppleMobileBackup";