移动端微信接入
This commit is contained in:
1 parent
ca91f45ef3
commit
31e8e3bebb
32 files changed
+17241
-9
No files matched your search
@@ -0,0 +1,69 @@
|
||||
//
|
||||
// IOSWechatController.m
|
||||
// Unity-iPhone
|
||||
//
|
||||
// Created by Jooki Tsui on 2020/11/13.
|
||||
//
|
||||
|
||||
#import "WXApi.h"
|
||||
#import "UnityAppController.h"
|
||||
#import <Foundation/Foundation.h>
|
||||
extern void UnitySendMessage(const char *,const char *,const char *);
|
||||
@interface IOSWechatController : UnityAppController<WXApiDelegate>
|
||||
@end
|
||||
|
||||
IMPL_APP_CONTROLLER_SUBCLASS (IOSWechatController)
|
||||
|
||||
@implementation IOSWechatController
|
||||
|
||||
- (BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity
|
||||
#if defined(__IPHONE_12_0) || defined(__TVOS_12_0)
|
||||
restorationHandler:(void (^)(NSArray<id<UIUserActivityRestoring> > * _Nullable restorableObjects))restorationHandler
|
||||
#else
|
||||
restorationHandler:(void (^)(NSArray * _Nullable))restorationHandler
|
||||
#endif
|
||||
{
|
||||
return [WXApi handleOpenUniversalLink:userActivity delegate:self];
|
||||
}
|
||||
|
||||
- (BOOL)application:(UIApplication*)application openURL:(NSURL*)url
|
||||
options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options
|
||||
{
|
||||
return [WXApi handleOpenURL:url delegate:self];
|
||||
}
|
||||
|
||||
- (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url
|
||||
{
|
||||
return [WXApi handleOpenURL:url delegate:self];
|
||||
}
|
||||
|
||||
- (void)onResp:(BaseResp *)resp
|
||||
{
|
||||
NSLog(@"47");
|
||||
if([resp isKindOfClass:[SendAuthResp class]])
|
||||
{
|
||||
SendAuthResp *temp = (SendAuthResp*)resp;
|
||||
int errorCode = temp.errCode;
|
||||
switch (errorCode) {
|
||||
case 0:
|
||||
UnitySendMessage("LoginPanel", "OnMobileWxLoginResp",[NSString stringWithFormat:@"true;%@",temp.code ].UTF8String);
|
||||
break;
|
||||
case -2:
|
||||
UnitySendMessage("LoginPanel", "OnMobileWxLoginResp", "false;用户取消");
|
||||
break;
|
||||
case -4:
|
||||
UnitySendMessage("LoginPanel", "OnMobileWxLoginResp", "false;用户拒绝授权");
|
||||
break;
|
||||
default:
|
||||
UnitySendMessage("LoginPanel", "OnMobileWxLoginResp", "false;登录失败");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (void)onReq:(BaseReq *)req
|
||||
{
|
||||
// do something
|
||||
}
|
||||
|
||||
@end
|
||||
Reference in new issue
Block a user