2012-08-07 51 views
0

我正在創建上傳的簡單文件。 文件上傳出現了一些意外的行爲。上傳視頻文件時出現iPhone ASIHTTP錯誤

當我運行從我的iMac構建到iPhone時,它工作正常,沒有任何問題。 但是,當我創建一個構建(IPA)文件。並從iTune安裝。請求失敗。

可能是ASIHTTP有問題嗎?

+0

你應該在你的應用程序檢查正確的內存管理。 – 2012-08-07 08:24:16

+0

你想要與我分享的任何鏈接? – 2012-08-07 08:49:41

回答

0

您可以從下面的代碼中獲取靈感。

-(IBAction)btnPostData_Clicked: (id)sender 
{ 
    NSString *file2 = [[NSBundle mainBundle] pathForResource:@"Ovation-Mike_Koenig-1061486511" ofType:@"mp3"]; 

    NSData *file1Data = [[NSData alloc] initWithContentsOfFile:file2]; 

    NSURL *audiourl = [NSURL URLWithString:@"http://alligator.netsmartz.us/iphone/iphone.php"]; 

    ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:audiourl]; 

    NSData *postData = [[NSData alloc] initWithContentsOfFile:file2]; 

    //SoundPath is your audio url path of NSDocumentDirectory. 
    [request addData:postData withFileName:@"Ovation-Mike_Koenig-1061486511.mp3" andContentType:@"audio/mp3" forKey:@"company_audio"]; 

    [request setDelegate:self]; 

    [request startSynchronous]; 
} 
+0

感謝盧克和MSB,但問題是,當我做一個建設(IPA)與我的客戶分享。其停止工作。 可能存在ASIHTTP庫文件的問題。我正在使用XCODE 4.3。 – 2012-08-08 07:25:14

+0

您在構建ipa時設置了哪些部署目標? – 2012-08-08 09:05:34

+0

設備:iPhone和部署目標:4.0 – 2012-08-08 09:54:43