如何将我的 Swift IOS 应用与 Pinterest 集成?

How do I Integrate my Swift IOS app with Pinterest?

我正在尝试将 pinterest 集成到我的 IOS 应用中 swift。 我有一张图片并单击一个按钮将其 post 添加到我的 Pinterest 帐户。 我浏览了 Pinterest SDK 文档:https://developers.pinterest.com/docs/sdks/ios/? 我已经安装了 Podfile 并获得了应用程序 ID,但我卡在了第 4 步。 4.配置PDK客户端 最后,您需要 link 您的 App ID 到您应用中的 PDK 客户端。 [PDKClient configureSharedInstanceWithAppId:@"12345"];

我不太清楚他们的意思。 我应该将此行添加到哪个文件以及该文件中的什么位置?

我在这里检查了一些 post,但它们看起来都很旧,所以我不确定它们是否正确。

该文件是 AppDelegate,您需要放置代码的方法是:

application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?)

Objective-C:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    [PDKClient configureSharedInstanceWithAppId:@"YourAppId"]
    .
    .
    .
    return YES;
}

Swift:

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
    PDKClient.configureSharedInstanceWithAppId("YourAppId")
    .
    .
    .
    return true
}

P.S。不要忘记在 appDelegate

中导入 PinterestSDK