2015-10-02 17 views
16

मैं आईओएस 9 और स्विफ्ट 2 में फेसबुक एसडीके के साथ एक सरल फेसबुक लॉगिन करने की कोशिश की लेकिन यह हमेशा मुझे एक त्रुटि फेंकता है:फेसबुक एसडीके लॉगिन तेज 2 आईओएस में त्रुटि फेंकता 9

*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSTaggedPointerString containsObject:]: unrecognized selector sent to instance 0xa326874756162667'

यह में होता है usr/include/dispatch/once.h और मैं इसे अकेले हल नहीं कर सकता। क्या किसी के पास कोई विचार है?

कोड यहाँ है:

import FBSDKCoreKit 
import FBSDKLoginKit 


let loginManager = FBSDKLoginManager() 
loginManager.logInWithReadPermissions(["basic_info", "email", "user_likes"], fromViewController: self.parentViewController, handler: { (result, error) -> Void in 
    if error != nil { 
     print(FBSDKAccessToken.currentAccessToken()) 
    } else if result.isCancelled { 
     print("Cancelled") 
    } else { 
     print("LoggedIn") 
    } 
}) 

अपडेट: यहाँ पूर्ण त्रुटि ढेर है:

2015-10-02 13:40:33.884 FacyNews[24902:1352812] -[NSTaggedPointerString containsObject:]: unrecognized selector sent to instance 0xa326874756162667 
 
2015-10-02 13:40:33.889 FacyNews[24902:1352812] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSTaggedPointerString containsObject:]: unrecognized selector sent to instance 0xa326874756162667' 
 
*** First throw call stack: 
 
(
 
\t 0 CoreFoundation      0x000000010dbe8f65 __exceptionPreprocess + 165 
 
\t 1 libobjc.A.dylib      0x000000010f87adeb objc_exception_throw + 48 
 
\t 2 CoreFoundation      0x000000010dbf158d -[NSObject(NSObject) doesNotRecognizeSelector:] + 205 
 
\t 3 CoreFoundation      0x000000010db3ef7a ___forwarding___ + 970 
 
\t 4 CoreFoundation      0x000000010db3eb28 _CF_forwarding_prep_0 + 120 
 
\t 5 FBSDKCoreKit      0x000000010d52ea8b +[FBSDKInternalUtility isRegisteredCanOpenURLScheme:] + 171 
 
\t 6 FBSDKCoreKit      0x000000010d52e8da +[FBSDKInternalUtility checkRegisteredCanOpenURLScheme:] + 362 
 
\t 7 FBSDKCoreKit      0x000000010d52d0ed __46+[FBSDKInternalUtility isFacebookAppInstalled]_block_invoke + 45 
 
\t 8 libdispatch.dylib     0x0000000110ded49b _dispatch_client_callout + 8 
 
\t 9 libdispatch.dylib     0x0000000110dd8e28 dispatch_once_f + 543 
 
\t 10 FBSDKCoreKit      0x000000010d52cff7 +[FBSDKInternalUtility isFacebookAppInstalled] + 87 
 
\t 11 FBSDKLoginKit      0x000000010d6d6cb1 -[FBSDKLoginManager logInParametersWithPermissions:] + 449 
 
\t 12 FBSDKLoginKit      0x000000010d6d7358 -[FBSDKLoginManager logInWithBehavior:] + 88 
 
\t 13 FBSDKLoginKit      0x000000010d6d72d4 -[FBSDKLoginManager logInWithPermissions:handler:] + 292 
 
\t 14 FBSDKLoginKit      0x000000010d6d55e7 -[FBSDKLoginManager logInWithReadPermissions:fromViewController:handler:] + 343 
 
\t 15 FacyNews       0x000000010d3a2e5c _TFFC8FacyNews20MasterViewController14viewWillAppearFS0_FSbT_U_FCSo13UIAlertActionT_ + 700 
 
\t 16 FacyNews       0x000000010d3a3297 _TTRXFo_oCSo13UIAlertAction_dT__XFo_iS__iT__ + 23 
 
\t 17 FacyNews       0x000000010d39e131 _TPA__TTRXFo_oCSo13UIAlertAction_dT__XFo_iS__iT__ + 81 
 
\t 18 FacyNews       0x000000010d3a2b40 _TTRXFo_iCSo13UIAlertAction_iT__XFo_oS__dT__ + 32 
 
\t 19 FacyNews       0x000000010d3a2b8c _TTRXFo_oCSo13UIAlertAction_dT__XFdCb_dS__dT__ + 60 
 
\t 20 UIKit        0x000000010e709fa5 -[UIAlertController _fireOffActionOnTargetIfValidForAction:] + 96 
 
\t 21 UIKit        0x000000010e70a785 __85-[UIAlertController _dismissAnimated:triggeringAction:triggeredByPopoverDimmingView:]_block_invoke + 30 
 
\t 22 UIKit        0x000000010e55fc9f -[UIPresentationController transitionDidFinish:] + 1248 
 
\t 23 UIKit        0x000000010e__56-[UIPresentationController runTransitionForCurrentState]_block_invoke_2 + 183 
 
\t 24 UIKit        0x000000010edb31e9 -[_UIViewControllerTransitionContext completeTransition:] + 101 
 
\t 25 UIKit        0x000000010e4a9daa -[UIViewAnimationBlockDelegate _didEndBlockAnimation:finished:context:] + 644 
 
\t 26 UIKit        0x000000010e4883a7 -[UIViewAnimationState sendDelegateAnimationDidStop:finished:] + 241 
 
\t 27 UIKit        0x000000010e488756 -[UIViewAnimationState animationDidStop:finished:] + 80 
 
\t 28 QuartzCore       0x00000001135e8d70 _ZN2CA5Layer23run_animation_callbacksEPv + 308 
 
\t 29 libdispatch.dylib     0x0000000110ded49b _dispatch_client_callout + 8 
 
\t 30 libdispatch.dylib     0x0000000110dd534b _dispatch_main_queue_callback_4CF + 1738 
 
\t 31 CoreFoundation      0x000000010db493e9 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9 
 
\t 32 CoreFoundation      0x000000010db0a939 __CFRunLoopRun + 2073 
 
\t 33 CoreFoundation      0x000000010db09e98 CFRunLoopRunSpecific + 488 
 
\t 34 GraphicsServices     0x00000001130a2ad2 GSEventRunModal + 161 
 
\t 35 UIKit        0x000000010e403676 UIApplicationMain + 171 
 
\t 36 FacyNews       0x000000010d39959d main + 109 
 
\t 37 libdyld.dylib      0x0000000110e2192d start + 1 
 
\t 38 ???         0x0000000000000001 0x0 + 1 
 
) 
 
libc++abi.dylib: terminating with uncaught exception of type NSException

अग्रिम धन्यवाद।

+0

में निम्न को जोड़कर

*** Terminating app due to uncaught exception 'InvalidOperationException', reason: 'fbauth2 is missing from your Info.plist under LSApplicationQueriesSchemes and is required for iOS 9.0' *** First throw call stack: 

और इसे हल करने के लिए आप 'LSApplicationQueriesSchemes' कुंजी जोड़ा है आपके Info.plist? इस उत्तर पर एक नज़र डालें: http://stackoverflow.com/a/32441523/228981 जो दिखाता है कि इसे विभिन्न सामाजिक नेटवर्कों के लिए कैसे देखना चाहिए। – ChrisH

+0

@ChrisH हां, मैंने जोड़ा लेकिन जैसा कि मैंने उत्तर दिया, मैंने इसे गलत तरीके से जोड़ा और एसडीके ने यह जांच नहीं की कि यह तारों की सरणी है या नहीं। – Gabriel

+0

@ गेब्रियल..क्या आप कामकाजी कोड पोस्ट कर सकते हैं? मुझे स्विफ्ट 2.0 में भी समस्याएं आ रही हैं – Saty

उत्तर

23

मैं इस समस्या का समाधान कर लिया। चूंकि दस्तावेज़ में LSApplicationQueriesSchemes के बारे में कुछ भी नहीं है लेकिन मुझे इसकी कमी के बारे में एक त्रुटि संदेश मिला है, मैंने कुंजी और "fbauth2" मान को स्ट्रिंग के रूप में info.plist में लिखा है लेकिन यह एक सरणी है और एसडीके प्राप्त करने का प्रयास करता है किसी भी जांच के बिना स्ट्रिंग ऐरे का तत्व यदि यह एक सरणी है।

हालांकि, मदद उत्तरों के लिए धन्यवाद।

+0

इसके लिए बहुत बहुत धन्यवाद! – AsTeR

-1

मुझे लगता है कि आपकी त्रुटि आपके द्वारा पोस्ट किए गए कोड में नहीं है। लेकिन "basic_info" अनुमति को हटाने का प्रयास करें क्योंकि इसे बहिष्कृत किया गया है और आईओएस 9 में यह कुछ अप्रत्याशित मूल्य बना सकता है।

आप इस पढ़ सकते हैं:।।

"इससे पहले, basic_info एक अनुमति आप के लिए पूछने के लिए किया था और निहित public_profile और एक साथ user_friends नई फेसबुक लॉग इन basic_info अब पदावनत है और अनुरोध किया नहीं किया जाना चाहिए के साथ इसके बजाय, पूछना public_profile और user_friends (यदि आवश्यक हो) के लिए स्पष्ट रूप से। "

Here

+0

धन्यवाद, इससे मदद मिलेगी लेकिन समस्या एक जैसी है। – Gabriel

3

आईओएस 9 में फेसबुकएसडीके को एकीकृत करते समय 'fbauth2' .plist जोड़ने के बारे में और जानने के लिए link देखें।

FYI करें,
मैं निम्न संदेश के साथ एक दुर्घटना का सामना करना पड़ रहा था: .plist

<key>LSApplicationQueriesSchemes</key> 
<array> 
    <string>fbapi</string> 
    <string>fb-messenger-api</string> 
    <string>fbauth2</string> 
    <string>fbshareextension</string> 
</array> 
संबंधित मुद्दे