Closed KavanBahrami closed 8 years ago
Remove reference will be enough. The files will remain physically but Xcode won't recognize it. Do you see any error message when building the project in Xcode? Also make sure the target you're building is your project, see on left top corner of Xcode, besides the run button.
@dzhuowen I believe I'm building the project.. the other dropdown options all look like react libraries. The build worked without error before deleting the before mentioned libraries. After I deleted them it failed, i didn't take a screenshot since I assumed this would happen after I deleted them.
I then:
Xcode jumped to this view:
I'm not sure if I should be spending time trying to 'debug' whats going on or go to the next steps thinking they might help. Directions imply that running the project should be working at this step. "Run the project in Xcode. Follow the Getting Started guide to set up a Facebook app."
You don't need to debug further, but can you paste the console stack trace from the beginning? Usually the error is at the very beginning.
I updated the Info.plist file (per instructions on https://developers.facebook.com/docs/ios/getting-started) and it built without issue.
I went back and removed the updated info and ran again and got the same error, pasted below. If this is standard before the following steps it might be nice to have it noted in the documented setup instructions.
2015-11-20 15:52:49.956 AuthApp[13657:459272] * 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: ( 0 CoreFoundation 0x0000000106261f45 exceptionPreprocess + 165 1 libobjc.A.dylib 0x0000000105882deb objc_exception_throw + 48 2 AuthApp 0x0000000102804a13 +[FBSDKInternalUtility checkRegisteredCanOpenURLScheme:] + 499 3 AuthApp 0x000000010283fbe8 +[FBSDKAppInviteDialog initialize] + 88 4 libobjc.A.dylib 0x0000000105883bff _class_initialize + 679 5 libobjc.A.dylib 0x0000000105889d23 lookUpImpOrForward + 176 6 libobjc.A.dylib 0x00000001058988bb objc_msgSend + 187 7 AuthApp 0x0000000102969e16 -[RCTFBSDKAppInviteDialog init] + 134 8 AuthApp 0x000000010288da4c -[RCTBatchedBridge initModules] + 2556 9 AuthApp 0x000000010288ac7f -[RCTBatchedBridge start] + 399 10 AuthApp 0x000000010288aa8f -[RCTBatchedBridge initWithParentBridge:] + 1695 11 AuthApp 0x000000010289aa58 -[RCTBridge setUp] + 504 12 AuthApp 0x000000010289a1d9 -[RCTBridge initWithBundleURL:moduleProvider:launchOptions:] + 649 13 AuthApp 0x00000001028fe847 -[RCTRootView initWithBundleURL:moduleName:initialProperties:launchOptions:] + 183 14 AuthApp 0x00000001027b0070 -[AppDelegate application:didFinishLaunchingWithOptions:] + 192 15 UIKit 0x0000000104371f24 -[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] + 272 16 UIKit 0x00000001043730ca -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 3415 17 UIKit 0x00000001043799c3 -[UIApplication _runWithMainScene:transitionContext:completion:] + 1750 18 UIKit 0x0000000104376ba3 -[UIApplication workspaceDidEndTransaction:] + 188 19 FrontBoardServices 0x0000000108d35784 -[FBSSerialQueue _performNext] + 192 20 FrontBoardServices 0x0000000108d35af2 -[FBSSerialQueue _performNextFromRunLoopSource] + 45 21 CoreFoundation 0x000000010618e011 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION + 17 22 CoreFoundation 0x0000000106183f3c CFRunLoopDoSources0 + 556 23 CoreFoundation 0x00000001061833f3 CFRunLoopRun + 867 24 CoreFoundation 0x0000000106182e08 CFRunLoopRunSpecific + 488 25 UIKit 0x00000001043764f5 -[UIApplication _run] + 402 26 UIKit 0x000000010437b30d UIApplicationMain + 171 27 AuthApp 0x00000001027b03df main + 111 28 libdyld.dylib 0x000000010735392d start + 1 ) libc++abi.dylib: terminating with uncaught exception of type NSException (lldb)
For the "fbauth2 is missing from your Info.plist under LSApplicationQueriesSchemes and is required for iOS 9.0" , follow the step "3. Whitelist Facebook Apps" in https://developers.facebook.com/docs/ios/ios9.
@dzhuowen thanks for the reference.
It would be useful to make a slight update in the instructions to prevent someone from thinking there was an issue where there wasn't one.
" Run the project in Xcode. Follow the Getting Started guide to set up a Facebook app, configure your Xcode project (the app will hang on the launch screen until you do), and set up the app delegate. You can skip the steps that talk about downloading and linking the Facebook SDK frameworks -- that's already taken care of by CocoaPods. "
@dzhuowen I have a follow up issue, rather than create a new thread I thought i should just continue down this 'install guide' path
https://developers.facebook.com/docs/ios/getting-started
In your AppDelegate.m add:
// AppDelegate.m
I read this to mean:
add: [[FBSDKApplicationDelegate sharedInstance] application:application didFinishLaunchingWithOptions:launchOptions]; return YES;
Then since there is already code there, don't close tag } but instead let the rest continue and close itself as it had already
Since the second reference is new:
I added it to the bottom of the doc in its own section:
This is incorrect since it's not letting the rest of the code load. I will be looking for some answers elsewhere but if you happen to know what I'm doing wrong please tell me... Should I be replacing the other code completely ?
Thanks for the advice! The app configuration guide in develope.facebook.com will be updated soon with the specific step to avoid this error 😉.
I removed "return YES;" and it builds but i'm still concerned i might have made an additional mistake
Oh you only need to add
[[FBSDKApplicationDelegate sharedInstance] application:application didFinishLaunchingWithOptions:launchOptions];
to any place inside the method
(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
before the origin
return YES
You're awesome @dzhuowen thank you for your help.
@dzhuowen followup: I ran login, using the code provided . Fb button appeared, i clicked, went through the steps, then on approval I hit an error. Is this due to how I placed the second block of code from step 6. Connect Application Delegate : https://developers.facebook.com/docs/ios/getting-started ??
2015-11-20 16:44:05.810 [info][tid:com.facebook.React.JavaScript] 'Running application "AuthApp" with appParams: {"rootTag":1,"initialProps":{}}. DEV === true, development-level warning are ON, performance optimizations are OFF' 2015-11-20 16:54:33.680 [info][tid:com.facebook.React.JavaScript] 'Running application "AuthApp" with appParams: {"rootTag":1,"initialProps":{}}. DEV === true, development-level warning are ON, performance optimizations are OFF' 2015-11-20 16:55:31.989 [info][tid:com.facebook.React.JavaScript] 'Running application "AuthApp" with appParams: {"rootTag":1,"initialProps":{}}. DEV === true, development-level warning are ON, performance optimizations are OFF' 2015-11-20 16:55:33.954 AuthApp[15599:486694] -canOpenURL: failed for URL: "fbauth2:/" - error: "(null)" 2015-11-20 16:55:33.988 AuthApp[15599:486694] -canOpenURL: failed for URL: "fbauth2:/" - error: "(null)" (lldb)
Do you register your Bundle Identifier in the developer site?
@dzhuowen Yes, I have. I just double checked to make sure.
I didn't see any errors in the stack trace.. One thing seems tricky to me is, after you remove all contents in the Libraries directory, do "pod install" and add linker flag in build setting, you should be able to run the app at that time without configuring anything from the getting started guide. This might be where the problem happens. If you want, you can recover to the state for your first screen shot and we can take a look at the stack trace (notice that the important message are at the very beginning, so there's nothing I can see from the first screenshot). OR, you can try the without cocoaPods option. FYI, when following the getting started guide to configure FBSDKCoreKit/LoginKit/ShareKit, remember to add the path to your framework folder to Framework Search Path in Xcode build setting. For react-native-fbsdkxxx, remember to finish all three steps. Hope this could help!!!
The Frameworks part is only for the non-cocoaPods install .. right? The directions make it out to be. "You can skip the steps that talk about downloading and linking the Facebook SDK frameworks -- that's already taken care of by CocoaPods."
I tried the non-Pods path and had sooo many more issues, also, though im really just getting started, i liked the dependency loading in pods, cool tool.
That said, I will rebuild the app again (practice makes perfect!!) and see if i can copy that console log.
Yes. That's why there's a step to add Other Linker Flag. Cool, just post below when you get the error!
Xcode Version 7.1.1 (7B1005)
STEPS TAKEN:
run: react-native init AuthApp
in AuthApp/ directory: npm install --save react-native-fbsdkcore npm install --save react-native-fbsdkshare npm install --save react-native-fbsdklogin
in AuthApp/ios directory: pod init
Open the generated PodFile and add the following code: source 'https://github.com/CocoaPods/Specs.git' pod 'React', :subspecs => ['Core', 'RCTImage', 'RCTNetwork', 'RCTText', 'RCTWebSocket'], :path => '../node_modules/react-native' pod 'react-native-fbsdkcore', :path => '../node_modules/react-native-fbsdkcore' pod 'react-native-fbsdklogin', :path => '../node_modules/react-native-fbsdklogin' pod 'react-native-fbsdkshare', :path => '../node_modules/react-native-fbsdkshare'
Make sure the react native project can be run in Xcode.
Remove all the subprojects under Libraries/ in Xcode: removed references
run: pod install
open: AuthApp.xcworkspace
go to Xcode's Target Build Setting section, find Other linker flags and add: $(inherited)
Build
Console Log: 2015-11-21 01:03:04.674 AuthApp2[28662:680191] * 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: ( 0 CoreFoundation 0x000000010942cf45 exceptionPreprocess + 165 1 libobjc.A.dylib 0x0000000108a4ddeb objc_exception_throw + 48 2 AuthApp2 0x00000001059cf9d3 +[FBSDKInternalUtility checkRegisteredCanOpenURLScheme:] + 499 3 AuthApp2 0x0000000105a0aba8 +[FBSDKAppInviteDialog initialize] + 88 4 libobjc.A.dylib 0x0000000108a4ebff _class_initialize + 679 5 libobjc.A.dylib 0x0000000108a54d23 lookUpImpOrForward + 176 6 libobjc.A.dylib 0x0000000108a638bb objc_msgSend + 187 7 AuthApp2 0x0000000105b34dd6 -[RCTFBSDKAppInviteDialog init] + 134 8 AuthApp2 0x0000000105a58a0c -[RCTBatchedBridge initModules] + 2556 9 AuthApp2 0x0000000105a55c3f -[RCTBatchedBridge start] + 399 10 AuthApp2 0x0000000105a55a4f -[RCTBatchedBridge initWithParentBridge:] + 1695 11 AuthApp2 0x0000000105a65a18 -[RCTBridge setUp] + 504 12 AuthApp2 0x0000000105a65199 -[RCTBridge initWithBundleURL:moduleProvider:launchOptions:] + 649 13 AuthApp2 0x0000000105ac9807 -[RCTRootView initWithBundleURL:moduleName:initialProperties:launchOptions:] + 183 14 AuthApp2 0x000000010597b030 -[AppDelegate application:didFinishLaunchingWithOptions:] + 192 15 UIKit 0x000000010753cf24 -[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] + 272 16 UIKit 0x000000010753e0ca -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 3415 17 UIKit 0x00000001075449c3 -[UIApplication _runWithMainScene:transitionContext:completion:] + 1750 18 UIKit 0x0000000107541ba3 -[UIApplication workspaceDidEndTransaction:] + 188 19 FrontBoardServices 0x000000010bf00784 -[FBSSerialQueue _performNext] + 192 20 FrontBoardServices 0x000000010bf00af2 -[FBSSerialQueue _performNextFromRunLoopSource] + 45 21 CoreFoundation 0x0000000109359011 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION + 17 22 CoreFoundation 0x000000010934ef3c CFRunLoopDoSources0 + 556 23 CoreFoundation 0x000000010934e3f3 CFRunLoopRun + 867 24 CoreFoundation 0x000000010934de08 CFRunLoopRunSpecific + 488 25 UIKit 0x00000001075414f5 -[UIApplication _run] + 402 26 UIKit 0x000000010754630d UIApplicationMain + 171 27 AuthApp2 0x000000010597b39f main + 111 28 libdyld.dylib 0x000000010a51e92d start + 1 29 ??? 0x0000000000000001 0x0 + 1 ) libc++abi.dylib: terminating with uncaught exception of type NSException (lldb)
I follow your step and can repro the error. Sorry to say that you actually need to finish the getting started guide if you want to install the share kit. After that I just create an iOS app following the getting started guide and try out the login button, everything looks good.
@dzhuowen On that point, the extra bit of text in the instructions will help for this 'error'
" Run the project in Xcode. Follow the Getting Started guide to set up a Facebook app, configure your Xcode project (the app will hang on the launch screen until you do), and set up the app delegate. You can skip the steps that talk about downloading and linking the Facebook SDK frameworks -- that's already taken care of by CocoaPods. "
As for the rest, I'm going to build and go through the steps a few times more on my own to see if I can figure it. But so far, I keep getting stuck at the end of the Auth. I can click in, auth the app, set permissions then it returns that before mentioned breakpoint (the one I reopened this thread to mention).. I can restart the app, facebook sees that I'm already authed after I click the fb login button, I click continue and it's the same breakpoint... not sure why yet.
I think this error:
-canOpenURL: failed for URL: "fbauth2:/" - error: "(null)"
is normal when starting up and authorizing the app. I see it twice but the app logs in fine.
In one of your screenshots (not the most recent one but the one before that) it looks like you have a breakpoint set at AppDelegate.m:66 . . . do you?
HA! I had no idea what those blue marks were. Thats funny, I hope that was the issue.. it appears like it might have been.
Thank you :)
Thanks @navels !
Hi,
after adding <key>NSAppTransportSecurity</key>
my project builds successfully but the simulator shows "could not connect to development server" red error screen even though i already have the server in the terminal.
the issue only raises with <key>NSAppTransportSecurity</key>
added. my ios SDK is 9.2
P.S: when run the project in .xcworkspace
, the server wont start automatically like in Cairn.xcodeproj
. is that normal.
@shangsunset
Hi,
I had the very same issue. Adding the following key to NSExceptionDomains should resolve the issue.
<key>localhost</key>
<dict>
<key>NSExceptionAllowsInsecureHTTPLoads</key> <true/>
</dict>
Here is the complete xml tag.
<key>NSAppTransportSecurity</key>
<dict>
<key>NSExceptionDomains</key>
<dict>
<key>facebook.com</key>
<dict>
<key>NSIncludesSubdomains</key> <true/>
<key>NSThirdPartyExceptionRequiresForwardSecrecy</key> <false/>
</dict>
<key>fbcdn.net</key>
<dict>
<key>NSIncludesSubdomains</key> <true/>
<key>NSThirdPartyExceptionRequiresForwardSecrecy</key> <false/>
</dict>
<key>akamaihd.net</key>
<dict>
<key>NSIncludesSubdomains</key> <true/>
<key>NSThirdPartyExceptionRequiresForwardSecrecy</key> <false/>
</dict>
<key>localhost</key>
<dict>
<key>NSExceptionAllowsInsecureHTTPLoads</key> <true/>
</dict>
</dict>
</dict>
Hi @badboytherock, thanks for your tip. that solved the issue.
do we still need to keep the original NSAppTransportSecurity
tag came with the project?
Option: Using CocoaPods Run Project in Xcode.
"and remove all the subprojects under Libraries/ in Xcode. This is because React Native's iOS code will be pulled in via CocoaPods."
I'm selecting all the project files in the main app Libraries folder and deleting them.
Point of Clarification: Options are to REMOVE REFERENCES, or TRASH Does it matter? Will removing just references cause conflicts later.
I ask because this is my 4th time attempting to get this to build and I keep running into errors. So I'm going step by step and confirming every step is correct via documentation etc.