1.注册微信开发账号,开通支付权限(注册谁都会了)
2.把三个文件拉进去
libWeChatSDK.a
WXApi.h
WXApiObject.h
3.添加URL Types
4.AppDelegate.m中添加微信账号
[WXApi registerApp:@”wxalsdfjalsfals” withDescription:@”tencent”];
回调
– (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url {
return [WXApi handleOpenURL:url delegate:self];
}
return [WXApi handleOpenURL:url delegate:self];
}
– (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation {
return [WXApi handleOpenURL:url delegate:self];
}
– (void)onResp:(BaseResp *)resp {
if ([resp isKindOfClass:[PayResp class]]) {
PayResp *response = (PayResp *)resp;
switch (response.errCode) {
case WXSuccess:
NSLog(@”suceess”);
break;
default:
NSLog(@”failed”);
break;
}
}
}
5.调用的文件
原创文章,作者:Maggie-Hunter,如若转载,请注明出处:https://blog.ytso.com/3279.html