가능하지만 이 아닌이 좋습니다.
경고 : : 모든 사용자는 허용하는 액세스 권한에 따라 모든 사용자가 보관 용 계정 (또는 App 폴더)을 읽고 쓸 수 있습니다.
나는 시작하기 가이드에서 권장 앱을 설치하는 가정 : 어떻게 작동하는지 https://www.dropbox.com/developers/core/authentication#ios
은 다음과 같습니다 당신이 드롭 박스에 로그인하면, 당신은 다시 응용 프로그램에 다시 연결됩니다. 드롭 박스는 다음과 AppDelegate에 방법의 사용을 URL 스키마를 등록을 받고하여이 작업을 수행합니다
- (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url;
보관이 url
매개 변수에 oauth_token
, oauth_token_secret
및 uid
전달합니다. 그런 다음 당신이 DBSession
다음과 같은 방법을 사용하여 API 호출을 할 때 나중에 사용하기 위해 다음을 저장합니다
- (BOOL)handleOpenURL:(NSURL *)url;
그래서 당신이 같은 App Key
및 Secret
를 사용하는 응용 프로그램을 생성 할 수있는 일.
테스트 APP
DBSession* dbSession =
[[[DBSession alloc]
initWithAppKey:@"APP_KEY"
appSecret:@"APP_SECRET"
root:ACCESS_TYPE] // either kDBRootAppFolder or kDBRootDropbox
autorelease];
[DBSession setSharedSession:dbSession];
요청 권한 부여
if (![[DBSession sharedSession] isLinked]) {
[[DBSession sharedSession] linkFromController:yourRootController];
}
그리고 권한 부여를받을 수 url
- (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url {
if ([[DBSession sharedSession] handleOpenURL:url]) {
if ([[DBSession sharedSession] isLinked]) {
NSLog(@"App linked successfully! url: %@", url);
// At this point you can start making API calls
}
return YES;
}
// Add whatever other url handling code your app requires here
return NO;
}
이것을 url
재치를 기록 할 AppDelegate에 메소드를 추가 h 인증 토큰. 복사, 그 다음 생산 응용 프로그램 (당신이 당신의 DBSession를 구성 직후에) 그냥이 (이전에 복사 한 하나 문자열 교체) 할의 :
생산 APP이 자동으로 연결됩니다
DBSession* dbSession =
[[[DBSession alloc]
initWithAppKey:@"APP_KEY"
appSecret:@"APP_SECRET"
root:ACCESS_TYPE] // either kDBRootAppFolder or kDBRootDropbox
autorelease];
[DBSession setSharedSession:dbSession];
if (![[DBSession sharedSession] isLinked]) {
[[DBSession sharedSession] handleOpenURL:[NSURL URLWithString:@"db-APP_KEY://1/connect?oauth_token=********&oauth_token_secret=********&uid=********"]];
}
을 DBSession
을 보관 용 계정에 추가하십시오.
당신은 권한을 부여 그냥 전에이를 호출하여 테스트 할 수 있습니다
[[DBSession sharedSession] unlinkAll];
난 그냥 앱을 다운로드 인증 토큰을 추출하고 모든 읽기/쓰기 API를 만들기 시작할 수 ANOTHER 경고 내가 원하는 전화. 이것은 완전히 안전하지 않으며 교육용으로 만 간주해야합니다.
나는 당신의 단계를 밟았지만,'[ERROR] 링크 요청을 확인할 수 없습니다 .' 오류가 발생합니다. SDK 개인 정보가 변경 되었습니까? 나는 동일한 기능을 원한다. 도움이 appriciated 것입니다. –