2011-02-02 17 views
-1

シミュレータでは何が実行されますが、デバイスでは正しく実行されません。デバイスが動作しません。シミュレータは実行します

私はftp経由でサーバーにファイルをアップロードしています。私はhttp://code.google.com/p/s7ftprequest/を使ってアップロードを行っています。 ftp経由で簡単にアップロードする方法はありますか?

ターゲットをクリーニングしてすべてをリセットしようとしましたが、それでも解決できません。

//create file for new submission 
[submission.text writeToURL:[NSString stringWithFormat:@"%d.txt", submissionNum] atomically:YES encoding:NSUTF8StringEncoding error:nil]; 

//create new number.txt file 
NSString *numberFileString = [NSString stringWithFormat:@"%d",submissionNum]; 
[numberFileString writeToURL:[NSString stringWithFormat:@"number.txt"] atomically:YES encoding:NSUTF8StringEncoding error:nil]; 

//connect and upload submission 
S7FTPRequest *ftpRequest = [[S7FTPRequest alloc] initWithURL:[NSURL URLWithString:@"ftp://cheekyapps.com/ezhighasiam"] 
               toUploadFile:[NSString stringWithFormat:@"%d.txt", submissionNum]]; 
+0

例外はありますか? – tomasmcguinness

+0

例外はありませんが、(Cocoa Error 260)が表示されます。私はエラーで何か情報を見つけることができません – Chris

+0

これを見たのですか? http://stackoverflow.com/questions/2547075/cocoa-contentsofdirectorypath-method-failing-with-error-for-certain-users-ma? – vikingosegundo

答えて

1

Googeling「ココアエラー260」あなたは、パスを使用していることを、私は考えてみましょう、デバイスは理解していません。たぶん、〜またはサンドボックスで動作しないパスで。

いくつかのコードを表示してください。あなたはそれのサンドボックス内のdoucumentフォルダのアプリケーションへのパスを構築する必要が

編集

This post might be a start。要するに

:ドキュメントは、あなたが何をすべきフォルダへのアクセスに

編集
これはあなたのftp要求を養うことができ、同じfilePathにしてドキュメントフォルダ

NSString* documentsPath = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0]; 

NSSting *filePath = [documentsPath stringByAppendingPathComponent:[NSString stringWithFormat:@"%d", %d.txt]]; 
[submission.text writeToFile:filePath atomically:YES encoding:NSUTF8StringEncoding error:nil]; 

にファイルを書き込み

+1

私は問題を引き起こしていると思うものを投稿しました..それは2つのファイルを作成して、それらをアップロードする – Chris

+0

は、バンドル内のファイルですか? – vikingosegundo

+0

わかりません。プログラムでファイルを作成するとき、どこに保存されるのか。私はまだObj-C – Chris

関連する問題