如何将文件上传到Dropbox ios

时间:2011-05-09 07:07:14

标签: ios uitableview dropbox dropbox-api

我正在尝试将文件上传到Dropbox。上传无效。上传方法如下。

//  RootViewController.m

-(NSString *)getDocumentPath{

    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
    NSString *path = [[paths objectAtIndex:0]stringByAppendingPathComponent:FILENAME];
    return path;
}
-(IBAction)download:(id)sender{
    NSLog(@"download pressed");
    [self.activityIndicator startAnimating];
    [self.restClient loadFile:@"/dbTutorial.plist" intoPath:[self getDocumentPath]];

}
-(IBAction)upload:(id)sender{

    NSLog(@"upload pressed");
    [self.activityIndicator startAnimating];
    NSString *path = [self getDocumentPath];
    [self.itemArray writeToFile:path atomically:YES];
    [self.itemArray uploadFile:FILENAME toPath:@"/" fromPath:path];// When I build this is the warning that I get:NSMutableArray may not respond to -uploadFiletoPath:fromPath


}

非常感谢你。任何帮助将不胜感激。

2 个答案:

答案 0 :(得分:1)

应该是 [self.restClient uploadFile:FILENAME toPath:@"/" fromPath:path];

答案 1 :(得分:1)

- (void)uploadPhoto
{

    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
    NSString *path = [[paths objectAtIndex:0]stringByAppendingPathComponent:@"Kallol.jpg"];

    NSString *pathString = @"/Photos";

    [self.restClient uploadFile:@"Kallol12.jpg" toPath:pathString fromPath:path];

}

我尝试使用上面的代码并且工作得很好.........