是的,您可以使用Dropbox API在Dropbox用戶的文件夾中上傳plist。
首先檢查this link設置你的項目
您可以使用這些片段(from this page):
NSString *localPath = [[NSBundle mainBundle] pathForResource:@"Info" ofType:@"plist"];
NSString *filename = @"Info.plist";
NSString *destDir = @"/";
[[self restClient] uploadFile:filename toPath:destDir
withParentRev:nil fromPath:localPath];
然後實現回調
- (void)restClient:(DBRestClient*)client uploadedFile:(NSString*)destPath
from:(NSString*)srcPath metadata:(DBMetadata*)metadata {
NSLog(@"File uploaded successfully to path: %@", metadata.path);
}
- (void)restClient:(DBRestClient*)client uploadFileFailedWithError:(NSError*)error {
NSLog(@"File upload failed with error - %@", error);
}
編輯: (如果您想要,您可以從a的Documents文件夾中加載plist第記得mainBundle是隻讀的,所以你不能修改駐留在主束plist中,你只能讀它)..這樣的:
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask, YES);
NSString *plistFilePath = [[paths objectAtIndex:0]stringByAppendingPathComponent:@"info.plist"];
NSDictionary *plistFile = [[NSMutableDictionary alloc] initWithContentsOfFile:plistFilePath];
來源
2012-03-10 18:10:17
Mat
你是一個高手!非常感謝您的幫助 ! – 2012-03-10 21:35:34
有一個小問題(對不起)! 如何從我的應用程序的Documents文件夾加載plist?它被稱爲「Menu.plist」 再次感謝您! – 2012-03-10 22:36:10
@WaesAntoine檢查我的edit..remember檢查答案接受(並upvote它,如果你想)如果它對你有用:) – Mat 2012-03-13 01:09:24