1
我只是嘗試將我的xcode項目與框帳戶集成在一起,用於按照「https://github.com/box/box-ios-sdk」中的步驟創建新文件夾。如何解決類型錯誤 - [NSURL initFileURLWithPath:]:nil字符串參數'
最初完成鏈接「http://developers.box.com/authentication-in-your-ios-app/」後的認證過程。
構建成功並獲取箱子帳戶認證過程並獲取創建新文件夾所需的名稱。然後,我經歷了以下幾個
Error- {Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[NSURL initFileURLWithPath:]: nil string parameter'}
代碼來創建新的文件夾:
- (void)viewDidLoad {
[super viewDidLoad];
self.title = @"Create Folder";
[self.textView becomeFirstResponder];
}
- (IBAction)gotobutton:(id)sender {
[Box createFolderWithName:self.textView.text parentFolderID:[BoxID numberWithInt:0] share:NO callbacks:^(id<BoxOperationCallbacks> on)
{
on.after(^(BoxCallbackResponse response)
{
if (response == BoxCallbackResponseSuccessful)
{
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Success"
message:@"Folder created." delegate:nil cancelButtonTitle:@"OK"
otherButtonTitles:nil] ;
[alertView show];
}
else
{
[BoxErrorHandler presentErrorAlertViewForResponse:response];
}
});
}];
}
如何擺脫錯誤的,在這之前做任何一個經驗嗎? 請幫忙!!!
你可以添加一個斷點(或'NSLog')之前'[盒createFolderWithName:...',並確保'self.textView.text'不是'nil'(可能是他們的SDK使用該字符串作爲路徑構建一個'NSURL')。 – Alladinian 2013-04-29 12:37:49
設置異常斷點並檢查堆棧。 – 2013-04-29 13:00:53
我在必要的地方有斷點,並且直到連接到帳戶帳戶的最後一步才工作正常。在運行時添加了NSLog和[self.textview.text] =「給定文件夾的名稱」,並且得到了異常,由於未捕獲的異常'NSInvalidArgumentException',原因:'*** - [NSURL initFileURLWithPath:]:零字符串參數' ***第一次拋出調用堆棧: (0x1a90012 0x1585e7e 0x1a8fdeb 0xf9c9b1 0xf9c93b 0x5426e 0x1ca86 0x16f853f 0x170a014 0x16fa418 0x16fa2a6 0x16fb280 0x16fb450 0x9a4b4e12 0x9a49ccca)的libC++ abi.dylib:終止叫做拋出異常 – sathyapriya 2013-04-30 06:49:56