在 iOS 中集成 Snapchat“Snap Kit”登录工具包

Posted

技术标签:

【中文标题】在 iOS 中集成 Snapchat“Snap Kit”登录工具包【英文标题】:Integrating Snapchat "Snap Kit" Login Kit in iOS 【发布时间】:2020-07-15 19:31:38 【问题描述】:

我正在尝试将 Snapchat 登录工具包集成到我的 ios 应用程序中,但在通过网络进行身份验证以及以应用程序和网络格式重定向时遇到了问题。

我正在关注本教程: https://medium.com/adventures-in-ios-mobile-app-development/snapchat-snap-kit-sdk-tutorial-for-ios-swift-311863074bab

这是我的项目: https://github.com/josh10237/Faxx

当我在模拟器(未安装 Snapchat)上运行时,我收到此错误:

objc[17265]: Class SCSDKCertificateTrust is implemented in both /Users/joshbenson/Library/Developer/CoreSimulator/Devices/66F76A7D-BB4C-4556-A401-10EA15A08DB1/data/Containers/Bundle/Application/065DF16F-AD5B-4B2B-BF66-6FE11538AE8C/faxx.app/Frameworks/SCSDKLoginKit.framework/SCSDKLoginKit (0x1025cfc08) and /Users/joshbenson/Library/Developer/CoreSimulator/Devices/66F76A7D-BB4C-4556-A401-10EA15A08DB1/data/Containers/Bundle/Application/065DF16F-AD5B-4B2B-BF66-6FE11538AE8C/faxx.app/Frameworks/SCSDKCoreKit.framework/SCSDKCoreKit (0x10258c158). One of the two will be used. Which one is undefined.
objc[17265]: Class SCSDKCertPinningHandler is implemented in both /Users/joshbenson/Library/Developer/CoreSimulator/Devices/66F76A7D-BB4C-4556-A401-10EA15A08DB1/data/Containers/Bundle/Application/065DF16F-AD5B-4B2B-BF66-6FE11538AE8C/faxx.app/Frameworks/SCSDKLoginKit.framework/SCSDKLoginKit (0x1025cfc58) and /Users/joshbenson/Library/Developer/CoreSimulator/Devices/66F76A7D-BB4C-4556-A401-10EA15A08DB1/data/Containers/Bundle/Application/065DF16F-AD5B-4B2B-BF66-6FE11538AE8C/faxx.app/Frameworks/SCSDKCoreKit.framework/SCSDKCoreKit (0x10258c1a8). One of the two will be used. Which one is undefined.
2020-07-15 12:19:00.609082-0700 faxx[17265:876600] [SnapKit] path=/v1/config trace_id=2A1162C3A2614AB2AF014E7BBA74EBC5
2020-07-15 12:19:01.138241-0700 faxx[17265:876597] [SnapKit] Dynamic config update status: success
TAPPED
2020-07-15 12:19:02.397957-0700 faxx[17265:876408] -canOpenURL: failed for URL: "snapchat://" - error: "The operation couldn’t be completed. (OSStatus error -10814.)"

然后,当我尝试单击继续按钮时,它什么也不做。这是屏幕的样子:here。但是当我在我的设备(安装了 Snapchat)上运行它时,我能够登录,它甚至重定向回我的应用程序,但我收到了这个错误:

objc[10201]: Class SCSDKCertificateTrust is implemented in both /private/var/containers/Bundle/Application/3712A2D0-3F4F-4739-BB94-548E9DC4200F/faxx.app/Frameworks/SCSDKLoginKit.framework/SCSDKLoginKit (0x102c23af8) and /private/var/containers/Bundle/Application/3712A2D0-3F4F-4739-BB94-548E9DC4200F/faxx.app/Frameworks/SCSDKCoreKit.framework/SCSDKCoreKit (0x102ad70c8). One of the two will be used. Which one is undefined.
objc[10201]: Class SCSDKCertPinningHandler is implemented in both /private/var/containers/Bundle/Application/3712A2D0-3F4F-4739-BB94-548E9DC4200F/faxx.app/Frameworks/SCSDKLoginKit.framework/SCSDKLoginKit (0x102c23b48) and /private/var/containers/Bundle/Application/3712A2D0-3F4F-4739-BB94-548E9DC4200F/faxx.app/Frameworks/SCSDKCoreKit.framework/SCSDKCoreKit (0x102ad7118). One of the two will be used. Which one is undefined.
2020-07-15 12:25:23.097183-0700 faxx[10201:2778821] [SnapKit] path=/v1/config trace_id=484613DFB37D4AD18027527FD9542058
2020-07-15 12:25:23.631449-0700 faxx[10201:2778821] [SnapKit] Dynamic config update status: success
TAPPED
2020-07-15 12:25:31.322429-0700 faxx[10201:2778820] [SnapKit] path=/v1/sdk/metrics/business trace_id=890EF31D286548C3AF57254B490BEA35
2020-07-15 12:25:34.347608-0700 faxx[10201:2778823] [] nw_read_request_report [C2] Receive failed with error "Software caused connection abort"
2020-07-15 12:25:34.347928-0700 faxx[10201:2778823] [] nw_read_request_report [C1] Receive failed with error "Software caused connection abort"
2020-07-15 12:25:34.348197-0700 faxx[10201:2778823] [] nw_read_request_report [C2] Receive failed with error "Software caused connection abort"
2020-07-15 12:25:34.354865-0700 faxx[10201:2778823] [] nw_read_request_report [C1] Receive failed with error "Software caused connection abort"

当用户通过身份验证时,(通过浏览器或应用程序)我希望他们被重定向到 WelcomeController 视图和访问他们数据的方式(即显示名称、bitmoji 等)。干杯!

【问题讨论】:

【参考方案1】:

模拟器没有响应的问题可能是我遇到的问题 (SnapKit login fails after upgrading from 1.3.2 to 1.6.5 (SCSDKLoginClient.application() returns false))。

这可能是 Snapchat SDK 中的一个错误。

在 1.6.2 版之前,这似乎在 sim 上有效。 1.6.3 及更高版本(目前通过 1.6.5)失败。

顺便说一句,您的示例项目似乎无法访问。

【讨论】:

以上是关于在 iOS 中集成 Snapchat“Snap Kit”登录工具包的主要内容,如果未能解决你的问题,请参考以下文章

iOS - 如何在 iOS 10 中集成推送通知?

我们可以在 IOS 5.0 中集成 Facebook SDK 3.1 吗? [复制]

在 iOS 中集成 PayTm 支付

在 iOS 应用中集成 pjsip

如何在 iOS 中集成 Chromecast API?

如何在IOS SDK中集成多个卖家的paypal?