如何将文件上传到 Dropbox ios

发布于 2024-11-05 13:07:08 字数 939 浏览 1 评论 0原文

我正在尝试将文件上传到 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


}

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

I'm trying to upload files to Dropbox. Upload is not working. The upload method is given below.

//  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


}

Thank you very much. Any help would be greatly appreciated.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

乖不如嘢 2024-11-12 13:07:08

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

It should be

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

春花秋月 2024-11-12 13:07:08
- (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];

}

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

- (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];

}

I tried with above code and work nicely.........

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文