Created
June 27, 2014 15:58
-
-
Save is8r/ea78c30d1db51727bc10 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-(NSNumber *) twit:(NSString*)s | |
{ | |
if(!twitterState) twitterState = [[NSNumber alloc] initWithInt:0]; | |
// | |
if(s == @"") { | |
if([twitterState intValue] == 0) if(twitterEngine && [twitterEngine isAuthorized]==YES) twitterState = [[NSNumber alloc] initWithInt:1]; | |
return twitterState; | |
} | |
UIViewController *controller = nil; | |
if (!twitterEngine || [twitterEngine isAuthorized]==NO) { | |
twitterEngine = [[SA_OAuthTwitterEngine alloc] initOAuthWithDelegate: self]; | |
twitterEngine.consumerKey = kOAuthConsumerKey; | |
twitterEngine.consumerSecret = kOAuthConsumerSecret; | |
controller = [SA_OAuthTwitterController controllerToEnterCredentialsWithTwitterEngine:twitterEngine delegate: nil]; | |
[viewController presentModalViewController: controller animated: YES]; | |
} else { | |
if([twitterState intValue] != 2) {//2重投稿禁止 | |
[twitterEngine sendUpdate:s]; | |
twitterState = [[NSNumber alloc] initWithInt:2]; | |
} | |
} | |
return twitterState; | |
} | |
-(void) twitReset | |
{ | |
twitterState = [[NSNumber alloc] initWithInt:0]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment