1

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

NSString *temp = [NSString stringWithFormat:@"%@/temp.txt", documentPath];
NSLog(temp);




// create our stream
NSOutputStream *outputStream =
[[NSOutputStream alloc] initToFileAtPath:temp append:YES];
[outputStream open];

// create our request
S3GetObjectRequest *getObjectRequest =
[[S3GetObjectRequest alloc] initWithKey:self.objectName
withBucket:self.bucket];
getObjectRequest.outputStream = outputStream;




// always make sure to close your streams when done
[outputStream close];
4

1 回答 1

2

您将需要使用NSSearchPathForDirectoriesInDomains来获取应用程序的文档目录并使用它来构建文件路径和名称。

    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,     NSUserDomainMask, YES);
    NSString *documentPath = [paths objectAtIndex:0];
于 2013-07-09T18:52:22.403 回答