2.建立應用html
設置圖片能夠使用一個小工具,詳情http://www.cnblogs.com/czq1989/p/5073586.htmlc++
通常審覈幾個小時就過了,審覈經過以後也能刪除掉這個應用sql
3.下載微信SDK微信
4.搭建開發環境app
導入開發包中的文件ide
導入依賴庫,官方說要導入四個工具
SystemConfiguration.frameworkpost
libz.tbd測試
libsqlite3.0.tbdui
libc++.tbd
配置url type
5.寫入相關代碼
AppDelegate.m中
注意一點,重寫的那兩個方法如今不用了,適配一下低版本就能夠了
導入WXApi.h
1 #import "WXApi.h"
遵照WXApiDelegate協議
1 @interface AppDelegate ()<WXApiDelegate>
在didFinishLaunchingWithOptions方法中進行App註冊
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { [WXApi registerApp:@"################"]; return YES; }
重寫appdelegate的兩個方法
1 - (BOOL) application:(UIApplication *)application handleOpenURL:(NSURL *)url { 2 return [WXApi handleOpenURL:url delegate:self]; 3 }
1 - (BOOL) application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation { 2 return [WXApi handleOpenURL:url delegate:self]; 3 }
在ViewController.m裏咱們建立一個button,點擊完成分享
1 #import "ViewController.h" 2 #import "WXApi.h" 3 4 @interface ViewController ()<WXApiDelegate> 5 6 @end 7 8 @implementation ViewController 9 10 - (void)viewDidLoad { 11 [super viewDidLoad]; 12 [self setButton]; 13 // Do any additional setup after loading the view, typically from a nib. 14 } 15 16 - (void)setButton { 17 UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom]; 18 [button setFrame:CGRectMake(120, 120, 120, 36)]; 19 [button setTitle:@"SharingTest" forState:UIControlStateNormal]; 20 [button setTitleColor:[UIColor blackColor] forState:UIControlStateNormal]; 21 [self.view addSubview:button]; 22 [button addTarget:self action:@selector(sendMessage) forControlEvents:UIControlEventTouchUpInside]; 23 } 24 25 - (void)sendMessage { 26 SendMessageToWXReq *req = [[SendMessageToWXReq alloc] init]; 27 req.text = @"TigerCui的測試消息,請忽略"; 28 req.bText = YES; 29 req.scene = WXSceneSession; 30 [WXApi sendReq:req]; 31 }
6.中間遇到的小問題