//方法2 iOS4.0版本以下的可以使用该方法获取url
- - (NSURL *)applicationDocumentsDirectory_Old {
- NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);//程序文件夹主目录
- NSString *documentsDirectory = [paths objectAtIndex:0];//Document目录
- NSString *storePath = [documentsDirectory stringByAppendingPathComponent:@"Data.sqlite"];
- NSURL *storeURL = [NSURL fileURLWithPath:storePath];
- return storeURL;
- }
//方法3 获取文件中的Image地址及UIImage
- NSString*imagePath = [[[NSBundlemainBundle] resourcePath] stringByAppendingPathComponent:@"Image"];
- imagePath = [artistImagePath stringByAppendingPathComponent:@"bg"];
- imagePath = [artistImagePath stringByAppendingPathComponent:@"bg.png"];
- NSLog(@"%@", imagePath);
- UIImage* pic = [UIImage imageWithContentsOfFile: imagePath];
- //输出:/Users/test/Library/Application Support/iPhone Simulator/4.1/Applications/Test.app/Image/bg/bg.png