Changed getTwitterUserName to use the correct callback mechanism to avoid crashes

This commit is contained in:
Michael Dreeling
2012-05-06 22:00:27 -04:00
parent a2412acce0
commit bf50e013c4
2 changed files with 7 additions and 3 deletions

View File

@@ -156,7 +156,11 @@
NSArray *accountsArray = [accountStore accountsWithAccountType:accountType];
ACAccount *twitterAccount = [accountsArray objectAtIndex:0];
NSString *username = twitterAccount.username;
[super writeJavascript:[[CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:username] toSuccessCallbackString:callbackId]];
NSString *jsResponse = [[CDVPluginResult resultWithStatus:CDVCommandStatus_OK
messageAsString:username]
toSuccessCallbackString:callbackId];
[self performCallbackOnMainThreadforJS:jsResponse];
}
}];

View File

@@ -22,8 +22,8 @@ Twitter.prototype.getMentions = function(success, failure){
cordova.exec(success, failure, "TwitterPlugin", "getMentions", []);
};
Twitter.prototype.getTwitterUsername = function(response){
cordova.exec(response, null, "TwitterPlugin", "getTwitterUsername", []);
Twitter.prototype.getTwitterUsername = function(success, failure) {
cordova.exec(success, failure, "TwitterPlugin", "getTwitterUsername", []);
};
cordova.addConstructor(function() {