2011-02-02 7 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

예외가 없지만 (코코아 오류 260) 발생합니다. – Chris

+0

오류에 대한 정보를 찾을 수 없습니까? http://stackoverflow.com/questions/2547075/cocoa-contentsofdirectorypath-method-failing-with-error-for-certain-users-ma? – vikingosegundo

답변

1

Googeling "코코아 오류 260"경로를 사용하고 있는지, 내가 생각하자,이 장치는 이해하지 못합니다. 아마 ~ 또는 sandboxing과 함께 작동하지 않는 경로.

몇 가지 코드를 보여 주시면 더 자세히 알 수 있습니다.

편집 당신은 샌드 박스의 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

방금 ​​문제를 일으킨 것으로 생각되는 내용을 게시했습니다. 두 개의 파일을 만든 다음 – Chris

+0

번들에있는 파일입니까? – vikingosegundo

+0

잘 모르겠습니다. 프로그래밍 방식으로 파일을 만들 때 저장되는 위치입니다. 나는 여전히 Obj-C – Chris

관련 문제