Integrate Dropbox in ios app, but without login pop

≡放荡痞女 提交于 2019-12-12 09:26:39

问题


I want to integrate Dropbox in my app. I have made one sample example using Dropbox document and sample code.

But the issue is, I don't want to open login popup. So is there any way so that I can use dropbox without login or some where I can set default login ID Password and automatically do login. so that I can use dropbox directly.

Thanks,

Hardik Shah


回答1:


Well you could put the files in Dropbox and then share them and use the shared URLs as resources to call. We actually do this for some of our developer blog assets. Hope that helps. Careful not to move the files otherwise the links will break.




回答2:


I used DropBox Core API and generated access token. That worked fine with me.

NSString *surl = @"https://api.dropbox.com/1/metadata/dropbox/";

NSURL *url = [[NSURL alloc] initWithString:surl];
NSMutableURLRequest *req = [[NSMutableURLRequest alloc] initWithURL:url];

[req setValue:[self getAuth] forHTTPHeaderField:@"Authorization"];

NSURLSessionConfiguration *config = [NSURLSessionConfiguration ephemeralSessionConfiguration];
[config setHTTPAdditionalHeaders:@{@"Authorization": @"Bearer xxxxxxxxxxxxxxxxxxxx"}];  // replace xs with you access token

NSURLConnection *conn = [[NSURLConnection alloc]initWithRequest:req delegate:self];

of course you need to handle NSURLConnectionDelegate protocol

that example gives you all files and folders at your dropbox account root



来源:https://stackoverflow.com/questions/15173815/integrate-dropbox-in-ios-app-but-without-login-pop

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!