A simple wrapper for weibo sdk
- Download the weibo sdk
- Add the
libWeiboSDKfolder into your project - Add "wb[YOUR_APP_KEY]" Url schema into
Info.plist. See微博IOS平台SDK文档V2.3.0.pdf. - Add
bundle IDtohttp://open.weibo.com/apps/[YOUR_APP_KEY]/info/basic. See微博IOS平台SDK文档V2.3.0.pdf. - Add following code snippet into
AppDelegate.m - Install the plugin,
phonegap local plugin add https://github.com/xu-li/phonegap-weibo.git - In xcode, add
<feature>in theconfig.xml - In xcode, add
<access origin="*" />in theconfig.xml - Done.
// register app
// e.g. cordova.plugins.Weibo.registerApp("2582532934");
cordova.plugins.Weibo.registerApp(YOUR_APP_KEY);
// show login dialog
// e.g. cordova.plugins.Weibo.showLoginDialog("https://api.weibo.com/oauth2/default.html", "all"
cordova.plugins.Weibo.showLoginDialog(YOUR_REDIRECT_URI, SCOPE);
// get the access token
cordova.plugins.Weibo.accessToken;
// share a message, using jQuery
$.post("https://api.weibo.com/2/statuses/update.json", {
status: "This is a test message.",
access_token: cordova.plugins.Weibo.accessToken
});#import "WeiboSDK.h"
#import "CDVWeibo.h"
...
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation
{
CDVWeibo *weiboPlugin = [self.viewController.pluginObjects objectForKey:@"CDVWeibo"];
return [WeiboSDK handleOpenURL:url delegate:weiboPlugin];
}<feature name="Weibo">
<param name="ios-package" value="CDVWeibo" />
</feature>