Download the DropBox SDK from the https://www.dropbox.com/developers/sync/sdks/ios
add this sdk to Your project and also add some other Frameworks.
1. Foundation.framework
2. UIKit.framework
3. CoreGraphics.framework
4. QuartzCore.framework
For login Feature Add this method where you want your app to open the Drop Box login page.
-(void)openDropBox
{
[DBRequest setNetworkRequestDelegate:self];
dbSession=[[DBSession alloc]initWithAppKey:APP_KEY appSecret:SECRET_KEY root:ROOT];
[DBSession setSharedSession:dbSession];
dbSession.delegate=self;
if (![[DBSession sharedSession] isLinked]) {
[[DBSession sharedSession] linkFromController:self];
}
restClient = [[DBRestClient alloc] initWithSession:dbSession];
restClient.delegate=self;
}
And also write these Delegate method for login
- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url
sourceApplication:(NSString *)source annotation:(id)annotation {
if ([[DBSession sharedSession] handleOpenURL:url]) {
if ([[DBSession sharedSession] isLinked]) {
}
return YES;
}
return NO;
}
- (void)networkRequestStarted
{
[[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:YES];
}
- (void)networkRequestStopped
{
[[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:NO];
}
0 Comment(s)