下載wechat DK,並把SDKExport(libwechatsdk.a,wxapi.h,wxapiobject.h)拖入項目並copysql
加入依賴庫(systemconfiguration.framework,libz.std,libsqlite3.0.std);api
添加URLtype-------URL scheme填寫微信平臺申請的AppId微信
在AppDelegate裏註冊並添加代理方法:app
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { // Override point for customization after application launch. [WXApi registerApp:@""]; return YES; } - (BOOL) application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<NSString *,id> *)options { return [WXApi handleOpenURL:url delegate:self]; } - (BOOL) application:(UIApplication *)application handleOpenURL:(NSURL *)url { return [WXApi handleOpenURL:url delegate:self]; }
6.實現文字發送的方法:
ide
-(void)testMessagesAct測試
{url
SendMessageToWXReq* req = [[SendMessageToWXReq alloc] init];spa
req.text = @"這是測試發送的內容。";3d
req.bText = YES;代理
req.scene = WXSceneSession;
[WXApi sendReq:req];
}
7.運行後出現bitcode錯誤,配置路徑的地方:設置bitcode爲NO.