目前在接入Facebook,iOS上面需要用到SceneDelegate。但是cocos生成的项目中没有这个类,也没有场景,不知道如何在cocos项目中添加SceneDelegate。没有这个类第一次可以调起登陆,第二次就返回cancelled了,不知道是不是和没有在scenedelegate中处理有关。
Facebook的这块文档如下:
iOS 13 将打开网址的功能移到了 SceneDelegate 中。如果您使用的是 iOS 13,请将以下方法添加到 SceneDelegate 中,以便登录或分享等功能的操作可按照预期运作:
Objective C
// Objective-C
//
// SceneDelegate.m
#import <FBSDKCoreKit/FBSDKCoreKit.h>
@import FacebookCore;
@interface SceneDelegate ()
@end
@implementation SceneDelegate
- (void)scene:(UIScene *)scene openURLContexts:(NSSet<UIOpenURLContext *> *)URLContexts
{
UIOpenURLContext *context = URLContexts.allObjects.firstObject;
[FBSDKApplicationDelegate.sharedInstance application:UIApplication.sharedApplication
openURL:context.URL
sourceApplication:context.options.sourceApplication
annotation:context.options.annotation];
}