Skip to content

Instantly share code, notes, and snippets.

@is8r
Created June 29, 2014 13:36
Show Gist options
  • Save is8r/079f5d5a84bf233757b9 to your computer and use it in GitHub Desktop.
Save is8r/079f5d5a84bf233757b9 to your computer and use it in GitHub Desktop.
//facebook
-(NSNumber *) facebook:(NSString*)s
{
if(!facebookState) facebookState = [[NSNumber alloc] initWithInt:0];
if(s == @"logout") {//ログアウトの場合
[_facebook logout:self];
facebookState = [[NSNumber alloc] initWithInt:0];
return facebookState;
}
if([facebookState intValue] == 2) return facebookState;
//状態取得したい時
if(s == @"") {
if(_facebook && _facebook.isSessionValid==YES) {
facebookState = [[NSNumber alloc] initWithInt:1];
} else {
facebookState = [[NSNumber alloc] initWithInt:0];
}
return facebookState;
}
//実行関連
if([facebookState intValue] == 0) {//ログインの場合
[self facebookAccountLogin];
} else if([facebookState intValue] == 1) {//投稿
[self postfacebook:s];
facebookState = [[NSNumber alloc] initWithInt:2];
}
return facebookState;
}
-(void) facebooktReset
{
facebookState = [[NSNumber alloc] initWithInt:0];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment