Skip to content

Instantly share code, notes, and snippets.

@cardinalblue
Created October 27, 2011 06:36
Show Gist options
  • Save cardinalblue/1318922 to your computer and use it in GitHub Desktop.
Save cardinalblue/1318922 to your computer and use it in GitHub Desktop.
logout and authroization
//============================
// mixi setup
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
_mixi = [[Mixi sharedMixi] setupWithType:kMixiApiTypeSelectorGraphApi
clientId:@"87b9651a2291e4853ac0"
secret:@"98866989c89c42e47d7d38394637faa84341ebb4"
appId:@"piccollage"];
[_mixi restore];
[_mixi reportOncePerDay];
//.....other setup
}
//============================
// mixi logout buttonPressed
- (void)logout
{
[_mixi logout];
[self cancelImagePicker];
}
//===========================
// authorization
- (void)presentMixiPicker
{
Mixi *mixi = [Mixi sharedMixi];
if (![mixi isAuthorized]) {
NSArray *permissions =
[NSArray arrayWithObjects:@"r_profile", @"r_photo", @"w_photo", @"w_voice", @"r_voice", nil];
if (![mixi authorizeForPermissions:permissions]) {
MixiWebViewController *vc = MixiUtilDownloadViewController(self, @selector(closeDownloadView:));
[self presentModalViewController:vc animated:YES];
}
}
else {
// show mixi image picker
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment