将 Facebook SDK 与 Xcode Swift 项目集成 - AppDelegate 错误?

劳里

我正在尝试根据此处的指南集成 Facebook SDK:https : //developers.facebook.com/docs/swift/getting-started

我已经完成了 CocoaPods 步骤,现在处于“连接您的应用程序委托”阶段。但是我从 Xcode 收到错误,阻止编译:使用未解析的标识符:SDKApplicationDelegate 未解析标识符的用户:SDKApplicationDelegate

这是我的 AppDelegate。我是否缺少导入语句或其他内容?

    //
//  AppDelegate.swift
//  TestFBSDK
//
//  Created by laurie hocking on 09/02/2019.
//  Copyright © 2019 laurie hocking. All rights reserved.
//

import UIKit

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {

    var window: UIWindow?


    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {
        SDKApplicationDelegate.sharedInstance().application(application, didFinishLaunchingWithOptions: launchOptions)
        return true
    }
    func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool {
        return SDKApplicationDelegate.sharedInstance().application(app, open: url, options: options)
    }
    func applicationWillResignActive(_ application: UIApplication) {
        // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
        // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
    }

    func applicationDidEnterBackground(_ application: UIApplication) {
        // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
        // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
    }

    func applicationWillEnterForeground(_ application: UIApplication) {
        // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
    }

    func applicationDidBecomeActive(_ application: UIApplication) {
        // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
    }

    func applicationWillTerminate(_ application: UIApplication) {
        // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
    }


}
qtngo

您应该导入 SDK:

import FacebookCore

我认为电话应该是:

SDKApplicationDelegate.shared

不是

SDKApplicationDelegate.sharedInstance()

希望这可以帮助。

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

即使在Xcode 6.3中更新了Facebook,AppDelegate应用程序功能中的Facebook SDK错误

Facebook SDK 4.0.1 Swift错误xcode 6.2 iOS 8.2

facebook集成错误2500 OAuthException xcode 8 Swift 3

如何在运行项目时修复Xcode AppDelegate错误?

使用iphone的swift的Facebook集成授权错误?

Xcode Swift iBeacon,范围从AppDelegate

将cocoapods集成/安装到现有的xcode项目,objective-c或swift中

Xcode-解析和Facebook头文件(SDK)错误

AppDelegate Typhoon与Swift 4的集成

在Xcode Scenes Swift iOS中集成Facebook和Twitter

尝试在appdelegate中调用AdColony.configure时,Swift / Xcode AdColony返回错误

Swift:XCode6 Beta 5在AppDelegate中的核心数据对象上给出了错误

Facebook Swift SDK:loginManager表达式类型含糊错误

集成Weex SDK后Xcode 9编译错误

将Unity集成到Swift项目中

将MicroSoft CodePush集成到Swift项目

将Facebook Web SDK与ReactJS组件状态集成

使用swift SDK将视频发布到Facebook

Facebook SDK在我的android项目中导致错误

将Box2d集成到Swift项目中会发现未找到Cassert文件的错误

将Facebook SDK添加到android项目时出错

将Box IOS SDK集成到我的ios项目中

使用 Swift 语言将 OpenCV 集成到 Xcode 中

收到错误:Xcode 10上的“ Swift不支持SDK'iPhoneSimulator11.2.sdk'”

Chartboost SDK Swift集成

无法使用Swift在Xcode中使用Parse 1.7.2和Facebook SDK 4.1创建新用户

使用Swift 4 / Xcode 10的Facebook SDK:参数类型为“ SDKLoggingBehavior?” 与预期的“序列”类型不符

Facebook Sdk Android错误建立

iOS Facebook SDK错误语言