임시 디렉토리에 파일을 쓰려고합니다. 나는 이것을 이렇게하고있다 :임시 디렉토리에 쓰기가 작동하지 않습니다.
NSString *_location = NSTemporaryDirectory();
NSString *_guid = [[NSCalendarDate calendarDate] descriptionWithCalendarFormat:@"%m%d%Y%H%M%S%F"];
_guid = [_guid stringByAppendingString:@".png"];
NSString *_tempFilePath = [NSString stringWithFormat:@"%@/%@", _location, _guid];
NSData *_temp_data = [imgRep representationUsingType: NSPNGFileType properties: nil];
[_temp_data writeToFile:_tempFilePath atomically: NO];
그러나 그것은 나를 위해 작동하지 않는다. 파일을 만들지 않습니다. 뭐가 문제 야?
P. NSTemporaryDirectory에서 고유 한 이름을 가진 디렉토리를 만든 다음 그곳에 파일을 쓰려고했지만 그 중 하나가 작동하지 않았습니다.
어디서나 파일이 생성되지 않는 것으로 나타났습니다. 사용자의 문서 폴더에 위치를 설정하려했지만 작동하지 않습니다.
'_uid' 및'_guid' ??? – trojanfoe
죄송합니다. 코드를 다시 작성하는 동안 실수를했습니다. – hockeyman