开发者

Application's Document folder in iphone

开发者 https://www.devze.com 2023-03-07 22:13 出处:网络
I am using dropbox API and downloading file in application document folder. I am able to view list of files in table from document directory. How can I read photos or file from this table view?

I am using dropbox API and downloading file in application document folder.

I am able to view list of files in table from document directory. How can I read photos or file from this table view?

And what about the iPhone. Can we access document folder direct开发者_如何学编程ly?


This is the more commonly used approach to get the documents directory –

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

NSString *filePath = [documentsDirectory stringByAppendingPathComponent:fileName];

You can use NSFileManager to examine the contents of the directory. You can look at the contentsOfDirectoryAtPath:error: method.


Access document Folder -

NSDictionary *theCatalogInfo=nil;
NSString *theCatalogFilePath = [NSString stringWithFormat:@"%@/Documents/",NSHomeDirectory()];
theCatalogFilePath = [theCatalogFilePath stringByAppendingString:@"File Name"];
if(nil!=theCatalogFilePath)
{


    theCatalogInfo=[[NSDictionary alloc]initWithContentsOfFile:theCatalogFilePath];

}

return theCatalogInfo;
0

精彩评论

暂无评论...
验证码 换一张
取 消