0

[Xcode V.7.0 Beta 6,OSX El Capitan,iOS9]

我正在尝试使用最新版本的 Parse SDK 添加 Twitter 登录。我尝试了几种将 Twitter 登录与 Parse 集成的方法,但它不起作用。我已经添加了我的消费者密钥/秘密,它说我需要初始化PFTwitterUtils我已经完成的操作。

You must call PFTwitterUtils initializeWithConsumerKey:consumerSecret: to use PFTwitterUtils"我在下面发布了完整的错误以及我的 github 存储库。

目前我没有添加 ParseTwitterUtils 框架,因为它没有在 Parse.com 上的快速入门指南中说我需要。但是,当我添加模块时,我得到一个linker error. 当我把它拿出来时,我得到下面的错误。

我采取的步骤:

  1. 起初,我遇到了 PFTwitterUtils 模块未出现或未被识别的问题。我构建了在此链接中添加框架的项目: https ://www.parse.com/apps/quickstart?app_id=discounts--6#parse_data/mobile/ios/swift/existing并在此处使用SDK:https:/ /www.parse.com/apps/quickstart?app_id=fblogin--81#parse_data/mobile/ios/swift/existing

(与此链接类似的问题:No such module 'Parse' following Parse iOS Swift Quickstart guide

我在github上发布了这个问题,认为这是他们的一个错误: https ://github.com/ParsePlatform/Parse-SDK-iOS-OSX/issues/407

我被建议检查Framework Search Path以查看模块是否位于搜索路径指向的文件夹中。它看起来不错,但仍然无法正常工作,因此我还尝试向 ParseSDK 添加另一条路径,但也没有用。

  1. 然后,我从 PFTwitterUtils 工作的另一个来源获取了一个 Parse-Starter-project(我的 github 存储库在新框架的下方),但随后我收到了下面提到的错误。我假设这是更好的解决方法,因为现在 PFTwitterUtils 在 Xcode 中被识别,但在构建项目时却没有。在 Twitter 上制作应用程序时,我还检查了回调 URL。我发现了一个与回调 URL 有问题的堆栈溢出问题。我也编辑了它,它仍然不起作用。

这是我得到的错误:

2015-10-14 13:13:18.374 ParseStarterProject[3757:390022] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'You must call PFTwitterUtils initializeWithConsumerKey:consumerSecret: to use PFTwitterUtils.' *** First throw call stack: ( 0 CoreFoundation 0x000000010f9849b5 __exceptionPreprocess + 165 1 libobjc.A.dylib 0x0000000111927deb objc_exception_throw + 48 2 CoreFoundation 0x000000010f9848ed +[NSException raise:format:] + 205 3 ParseStarterProject 0x000000010eddcd7e +[PFTwitterUtils logInInBackground] + 31 4 ParseStarterProject 0x000000010eddce30 +[PFTwitterUtils logInWithBlock:] + 48 5 ParseStarterProject 0x000000010edca6b1 _TFC19ParseStarterProject14ViewController11viewDidLoadfS0_FT_T_ + 417 6 ParseStarterProject 0x000000010edca8c2 _TToFC19ParseStarterProject14ViewController11viewDidLoadfS0_FT_T_ + 34 7 UIKit 0x00000001106cbd05 -[UIViewController loadViewIfRequired] + 877 8 UIKit 0x00000001106cc054 -[UIViewController view] + 27 9 UIKit 0x00000001105ab77c -[UIWindow addRootViewControllerViewIfPossible] + 61 10 UIKit 0x00000001105abe79 -[UIWindow _setHidden:forced:] + 302 11 UIKit 0x00000001105bd6dc -[UIWindow makeKeyAndVisible] + 43 12 UIKit 0x000000011053dd13 -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 4003 13 UIKit 0x000000011054413d -[UIApplication _runWithMainScene:transitionContext:completion:] + 1755 14 UIKit 0x0000000110541390 -[UIApplication workspaceDidEndTransaction:] + 188 15 FrontBoardServices 0x00000001193b57ac -[FBSSerialQueue _performNext] + 192 16 FrontBoardServices 0x00000001193b5b1a -[FBSSerialQueue _performNextFromRunLoopSource] + 45 17 CoreFoundation 0x000000010f8b0b21 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17 18 CoreFoundation 0x000000010f8a6a4c __CFRunLoopDoSources0 + 556 19 CoreFoundation 0x000000010f8a5f03 __CFRunLoopRun + 867 20 CoreFoundation 0x000000010f8a5918 CFRunLoopRunSpecific + 488 21 UIKit 0x0000000110540d2d -[UIApplication _run] + 402 22 UIKit 0x000000011054599e UIApplicationMain + 171 23 ParseStarterProject 0x000000010edcce6d main + 109 24 libdyld.dylib 0x0000000116bed92d start + 1 25 ??? 0x0000000000000001 0x0 + 1 ) libc++abi.dylib: terminating with uncaught exception of type NSException (lldb)

//

在存储库中 ParseTwitterUtils.framework 模块不存在。但是一旦我导入它,我会得到一个linker error.

难道是我错过了框架搜索路径?当我添加框架所在的框架搜索路径时,它不会改变任何东西。关于如何使用我正在使用的当前 SDK 添加带有 Parse 的 TwitterSDK 的任何想法?

这是我的存储库的链接。https://github.com/rnyfo4/ParseStarterProject-2/tree/c512acb4360d45927f0cc5b34505d3caacae728c

任何帮助都意味着很多。先感谢您。

如果我能提供更多信息,请告诉我。

4

1 回答 1

0

我解决了。正如我所提到的,我去了 github 并得到了帮助。

这是正在发生的事情的答案:

According to this guide, to enable authentication with Twitter - you need to call PFTwitterUtils.initializeWithConsumerKey:consumerSecret: The exception is being thrown about the fact that you simply didn't initialize the twitter utils, so there is no need to unlink/remove ParseTwitterUtils from Cocoapods. pod 'ParseTwitterUtils' and ParseTwitterUtils.framework are mutually exclusive, as they are absolutely the same thing, with the only difference on how you install them.

这是解决方案:我需要编辑我的 AppDelegate didFinishLaunchingWithOptions 方法以反映以下内容:

`Parse.enableLocalDatastore()
Parse.setApplicationId("...",
        clientKey: "...")

PFTwitterUtils.initializeWithConsumerKey("...",     consumerSecret:"...")`

希望这对将来遇到此问题的人有所帮助。

于 2015-10-16T08:18:08.287 回答