-
Notifications
You must be signed in to change notification settings - Fork 0
/
使用说明.txt
87 lines (69 loc) · 2.34 KB
/
使用说明.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
version:1.1.1
author: yueyuanya
微博ios版ane使用说明:
1.将weibo_ios.swc添加到air工程库路径
将weibo_ios.ane添加到air本机扩展路径
在iOS打包设置-本机扩展选中weibo_ios.ane
2.as代码调用接口
var weibo:WeiboAPI=new WeiboAPI();
//注册app key
weibo.registerKey(appkey,redirecturl);
//授权
weib.auth(scope);
//发布(分享)
weibo.share(content:String,bitmapData:BitmapData);
//动态call 直接调用libWeiboAPI.a中定义好的code
weibo.call(code:String,data:*);
3.as监听微博响应状态
weibo.addEnevtListener(WeiboAPIEvent.RESPONSE,onResp);
通过weibo.code weibo.level取到响应数据
//授权成功响应
weibo.code="respTokenSuccess";
weibo.level=token;//token值
//授权失败
weibo.code="respTokenFail";
weibo.level= statusCode;//见weibosdk WeiboSDKResponseStatusCode定义
//分享成功 (只有分享成功才会监听到,失败或取消时未处理,可自行修改Manager.m-didReceiveWeiboResponse)
weibo.code="respShare";
weibo.level=statusCode;//实际为0 见weibosdk WeiboSDKResponseStatusCode定义
//用于调试的公共响应
//只要收到微博响应就会触发WeiboAPIEvent.RESPONSE
//一次响应会先后触发respStart respEnd
weibo.code="respStart";
weibo.code="respEnd";
4.as监听openurl
需要通过invoke方式监听app的openURL,交给weibosdk处理
NativeApplication.nativeApplication.addEventListener(InvokeEvent.INVOKE,onInvoke);
private function onInvoke(e:InvokeEvent):void{
trace("invoke");
if (Capabilities.manufacturer.indexOf("iOS") != -1)//只在ios下采用这种方式
{
if (e.arguments != null && e.arguments.length > 0)
{
var url:String = e.arguments[0] as String;
if ( url != null)
{
weibo.call("openURL", url);
}
}
}
}
5.app-xml添加配置
在<iPhone> <InfoAdditions>后添加以下配置
<key>MinimumOSVersion</key>
<string>6.1</string>
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>CFBundleURLName</key>
<string>com.weibo</string>
<key>CFBundleURLSchemes</key>
<array>
<string>wb1112872085</string>
</array>
</dict>
</array>
wb1112872085改为自己的appkey
由于libWeiboAPI.a编译版本为ios6.1以上,所以MinimumOSVersion为6.1