React Native / Xcode Upgrade and now RCTConvert.h not found - xcode

App ran fine on React Native 0.35.0. After updating to 0.40.0 via react-native-git-upgrade I get a number of lexical/preprocessor issues when trying to build/run the app in XCode.
React/RCTBridgeModule.h' file not found
When clicking on the issue I see this highlighted:
#import <React/RCTBridgeModule.h>
It doesn't appear to be a search path issue.
I've tried deleting node_modules and running npm install again, but that hasn't fixed anything.

As pointed out by th0th, there is a breaking change in RN 0.40 for iOS. In short, RN header declarations are updated to point to the include path $(BUILT_PRODUCTS_DIR)/include/React.
To solve the issue, you have to do the following:
In Xcode, go to the project scheme (Product -> Scheme -> Manage Scheme -> double click your project).
Click on the 'Build' option at the left pane.
Uncheck 'Parallelize Build' under Build Options.
Then in Targets section, click '+' button then search for 'React'. Select it and click 'Add'.
'React' should now appear under Targets section. Click and drag it to the top so that it will be the first item in the list (before your project).
Clean the project and build.
Note: You might still have similar header issue with other libraries (e.g. react-native-fbsdk) that are referring to those react native .h files.

In react-native 0.40
you have to replace #import "RCTBridgeModule.h" with #import <React/RCTBridgeModule.h>
then clean and build it again.

There is a breaking change on 0.40, you can see details here.
Quoting directly from the release notes:
This means that all iOS native libraries need a major version bump
for RN 0.40. We attempt to minimize changes of this magnitude, and we
apologize for any inconvenience caused.
So, all native iOS libraries will need an update before getting compatible with react-native version 0.40.

I had the same issue. I have solved it by removing the Test target of my app from build scheme.

If your app isn't to large, just
1) rename original app
2) create the same app again react-native init <orig_app_name>
3) copy over all necessary files from your original app to the newly created one
4) adjust the package.json
5) npm install
6) react-native run-<ios|android>
I spent hours to find, where to link the new libraries, it was at least a valuable option and shortcut for me.
hope it helps somebody

If you use pod, maybe you can try this solution:
Go to Header Search Paths:
Pods -> TARGETS -> (YOUR TARGET, like my target is RNGL) -> Build Settings -> All -> Search Paths -> Header Search Paths
add a path:
"${PODS_ROOT}/Headers/Public/React" non-recursive

This steps helped solve my issue. I tried "Uncheck parallelize build" steps. It did not work for me.
Open up your project in XCode.
Open up the Libraries folder. You should see React.xcodeproj and several RCT*.xcodeproj.
Drag the React.xcodeproj into each of the other projects.
Click on each project and navigate to the Build Phases tab.
Click on Target Dependencies and add React as a target dependency

Here is how I made it work:
I cleaned my package.json to the latest version,
I did the trick by #max23_
I replaced all the
#import '....h' that were causing error to the corresponding #import <React/.....h>.

Update from
import "RCT/BridgeModule.h"
to
import "React/RCT/BridgeModule.h"
the clean and build.
Although, I have not tested it, I suspect if I made no changes and just clean and build it would have done the trick.

Changing the path from:
#import <React/RCTBridgeModule.h>
to:
#import <React/Base/RCTBridgeModule.h>
worked for me.

Related

Xcode 10 Error: Multiple commands produce

error: Multiple commands produce '/Users/uesr/Library/Developer/Xcode/DerivedData/OptimalLive-fxatvygbofczeyhjsawtebkimvwx/Build/Products/Debug-iphoneos/OptimalLive.app/Info.plist':
1) Target 'OptimalLive' has copy command from '/Users/uesr/Desktop/workSpace/SEALIVE/SeaLive1.1/OptimalLive/Info.plist' to '/Users/uesr/Library/Developer/Xcode/DerivedData/OptimalLive-fxatvygbofczeyhjsawtebkimvwx/Build/Products/Debug-iphoneos/OptimalLive.app/Info.plist'
2) Target 'OptimalLive' has copy command from '/Users/uesr/Desktop/workSpace/SEALIVE/SeaLive1.1/OptimalLive/Server/Masonry/Info.plist' to '/Users/uesr/Library/Developer/Xcode/DerivedData/OptimalLive-fxatvygbofczeyhjsawtebkimvwx/Build/Products/Debug-iphoneos/OptimalLive.app/Info.plist'
3) Target 'OptimalLive' has process command with input '/Users/uesr/Desktop/workSpace/SEALIVE/SeaLive1.1/OptimalLive/Info.plist'
Running the code in Xcode 9 works, but there is an error in Xcode 10.
The issue might be occurring because of multiple Plist or other files within App-
Solution -> Open target -> Build phases > Copy Bundle Resources and remove info.plist from there.
Note: If you have developed a watch app too then you will have to remove the plist from the watch and watch-extension too.
This answer is deprecated - Xcode 12 has deprecated the Legacy Build System, it will be removed in a further release
I found the solution for this build error, for anybody else having the same issue with Xcode 10 build system, follow the following steps to fix it:
In Xcode, go to File->Project/Workspace settings.
Change the build system to Legacy Build system.
It will resolve the build issue with the new Xcode 10.
If you want to work with the new build system, then you can find the troubleshooting help from this apple Xcode help page.
Go to Xcode -> File ->Workspace Settings.
You will find one pop up like.
Select "Legacy Build System" from Build System tag.
Press on "Done"
Note:- Make sure clear your project with "cmd+shift+alt+k" and "Derived Data"
Build your project it will work charm :)
I was experimenting with Core Data. I built a data model for a simple checklist program and generated the NSManagedObjects. When I compiled the project I got the following error:
error: Multiple commands produce '/Users/myUSerName/Library/Developer/Xcode/DerivedData/myCoreDateExperiment-gzbslaqdwglkzxemijpdqmizgyzc/Build/Intermediates.noindex/ myCoreDateExperiment /Debug-iphonesimulator/ myCoreDateExperiment.build/Objects-normal/x86_64/CheckListItem+CoreDataProperties.o':
1) Target ' myCoreDateExperiment ' (project ' myCoreDateExperiment ') has compile command for Swift source files
2) Target ' myCoreDateExperiment ' (project ' myCoreDateExperiment ') has compile command for Swift source files
The problem was the data model (CheckList.xcdatamodeld in my case) was in the "Compile Sources" list. The project compiled cleanly when I removed it from the list.
Open the project navigator and select the project (very first entry at the top)
Select your build target under Targets in the "Projects and Targets" pane
Select Build Phases option near the top
Expand the "Compile Sources" entry and look for your data model name. Search for "xcdatamodeld" if you have trouble finding it.
Delete the model from the compile list
Make sure the data model is included in the "Copy Bundle Resources" list. Add it if it is missing.
EDIT
As #WilliamT. explains in the comments, you need the xcdatamodeld in the compile list. Instead, go to your entities within the xcdatamodeld file. Select the models that are erroring, expand the left panel, and change the field of "Codegen" to "Manual/None".
This answer is deprecated - XCode 12 has deprecated the Legacy Build System, it will be removed in a further release
Try this as well.
Xcode->File->Project Settings-> Build System -> Legacy Build System.
If you are getting this from the Ditto command creating multiple instances of the same name (NOT the 'copy files' build phase), you may have to change the Product Module Name.
Click on your Target(s) Xcode is complaining about
Click on Build Settings
Search for Product Module Name
Change the name to something unique
We have a watch target and a few notification targets in our app, so I just put things like Extension on the end of the module name.
I found this solution originally here: https://forums.developer.apple.com/thread/103913
If you use CocoaPods you may want to try deintegrate the pods and install again. It works for me.
pod deintegrate
pod install
While checking the build log, I noticed a warning:
note: Using new build system
note: Planning build
note: Constructing build description
Build system information
warning: The Copy Bundle Resources build phase contains this target's Info.plist file '/Users/<redacted>/Repositories/Whitesmith/optimize-ios/Carthage/Checkouts/WSStatusBarNotification/Miscellaneous/Info.plist'. (in target 'JDStatusBarNotification')
So, if that's your case then just go to your target:
Build Phases
Copy Bundle Resource
Remove info.plist.
Read this answer if error message references Core Data files
Synopsis: You may have both automatically-generated and manually-generated Core Data managed object class files.
This answer applies if the first line of the error refers to a Foo+CoreDataProperties.o or Foo+CoreDataClass.o file. Example:
error: Multiple commands produce '/Users/me/Library/Developer/Xcode/DerivedData/MyApp-uebslaqdwgldkjemijpdqmizgyzc/Build/Intermediates.noindex/ MyApp /Debug-iphonesimulator/ MyApp.build/Objects-normal/x86_64/Foo+CoreDataProperties.o':
1) Target ' MyApp ' (project ' MyApp ') has compile command for Swift source files
2) Target ' MyApp ' (project ' MyApp ') has compile command for Swift source files
The root cause can be seen by expanding the Compile Swift Source Files section of the Build Transcript. For example:
<unknown>:0: error: filename "Address+CoreDataClass.swift" used twice: '/Users/myUserName/Projects/Jnky/Foo+CoreDataProperties' and '/Users/jk/myUserName/Developer/Xcode/DerivedData/MyApp-uebslaqdwgldkjemijpdqmizgyzc/Build/Intermediates.noindex/MyApp.build/Debug/MyApp.build/DerivedSources/CoreDataGenerated/Jnky/Foo+CoreDataProperties.swift'
The first file mentioned there is a source file in your project directory, which someone generated by selecting your data model in the Project Navigator and clicking in the menu Editor > Create Managed Object Subclass. This feature was added in Xcode 7 or so.
The second file is a file of the same name but which is buried in Xcode's DerivedData. This file is generated automatically by Xcode during every build if the data model (.xcdatamodeld) file is included in the target's Compile Sources build phase. This feature was added in Xcode 9 or so. Zero, one or two files are generated for each entity/class, depending on the setting of the Codegen popup. That popup is in the Data Model Inspector when you select an entity while editing your data model…
The settings are:
Manual/None No files are generated
Category/Extension One file, Foo+CoreDataProperties.m or .swift is generated, containing an Objective-C category or Swift extension.
Class Definition That same Category/Extension file is generated, and in addition a Foo+CoreDataClass.m or .swift is generated, containing class declaration and definition.
So you see the problem occurs when a developer (like me) who is accustomed to the older Xcode begins a project in a newer Xcode. We think that we need to use the Create Managed Object Subclass menu item, which we do, to create the files we can see in the Project Navigator while not realizing that our settings in the Codegen popup are causing Xcode to create duplicate files, which Apple "cleverly" does not show in the Project Navigator, because they don't trust developers to read and heed the comment in the header // This file was automatically generated and should not be edited.
Solution 1 - Use the Older Way
You can disable all automatic Codegen for a data model with just one setting:
Open the problem Target's Build Phases (In Project Navigator, select project, then in list of TARGETS which appears, select the problem target, then tab Build Phases).
Expand the Compile Sources entry and find the problem data model (.xcdatamodeld file).
Delete it from the compile list
Ensure the data model is included in the Copy Bundle Resources list.
Solution 2 - Core Data Magic For Beginners
Here, you go all in on the newer way.
Leave your data model as is in that Compile Sources.
In each Entity Inspector in your data model, set Codegen to Class Definition.
In the Project Navigator, delete and trash any Foo+CoreDataClass files, and rename any Foo+CoreDataProperties.m or .swift files to something like Foo+MyProperties.
In each Foo+MyProperties.m or .swift file, if there are properties generated by Xcode, delete these properties because they will be in the hidden files created by Codegen.
With this solution, your class definitions are generated automatically from the data model on each build. You can't even see them. It is Core Data Magic, nice and simple for beginners.
Solution 3 - For Most Real-World Apps
But Solution 2 is no good if you really want to add non-managed properties. (Objective-C does not allow properties to be added in categories, and Swift does not allow stored properties to be added in extensions.) So in most real-world apps, you probably want to go halfway between Solutions 1 and 2…
Leave your data model in the list of Compile Sources
In each Entity Inspector in your data model, set Codegen to Category/Extension.
In the Project Navigator, delete and trash any Foo+CoreDataClass.m or .swift files, and, to reduce future confusion, rename any Foo+CoreDataProperties.m or .swift files to maybe just Foo.m or .swift.
Ensure that each Foo.m or .swift file contains the class definition, to which you can add your own non-managed properties.
(Acknowledgments to the answer by Positron. My answer here explains why Positron's answer (my Solution 1) works, and adds Solution 2 and Solution 3.)
Solution 1 :
Open target ➼ Build phases ➼ Copy Bundle Resources ➼ remove info.plist from there. ➼ you will have to remove the plist from the Extensions too (if any).
Solution 2:
If you use CocoaPods you may want to try deintegrate the pods and install again.
Commands:
1) pod deintegrate
2) pod install
Solution 3:
In Xcode, go to File ➼ Project/Workspace settings.
➼ Change the build system to Legacy Build system.
I had the same problem, I had a one more helper app in main App and copy this in resource. In my case solved as :-
1) Target -> 2)Build Phases 2) Copy File (n items) 3) Remove Copy File.
The Helper app automatically copied in Xcode 10.0.
Try this Its Working :
In Xcode, go to File->Project/Workspace settings.
Change the build system to Legacy Build system.
None of the solutions proposed here worked for me. This was particularly due to CocoaPods. I was previously using Cocoapods 1.3.1. Simply upgrading to 1.5.3 didn't resolve the issue right away.
The steps I followed were:
Delete Podfile.lock
Delete Pods directory
Delete Derived Data & Clean
Exit Xcode
Update CocoaPods to 1.5.3
Run pod install
Open workspace and build
One option which solved my issue is to changing build system to legacy build system. Please follow the following steps in Xcode 10+.
Here I have written a detailed article on the problem & its solution. Xcode Error: Multiple commands produce
In my case PDFGenerator was producing an info.plist file, I just deleted it.
This answer is deprecated - Xcode 12 has deprecated the Legacy Build System, it will be removed in a further release
I'm using Xcode 11.4
Can't build old project
Xcode => File => Project Settings => Build System => Legacy Build System
Before I begin note that my project utilizes Carthage as a dependency manager.
None of the existing answers here resolved my issue. What did resolve the issue for me was the following.
First, I noticed that the build error pointed out one framework in particular. Next I filtered App Target > Build Phases for that framework. I noticed that that framework was present in both "Link Binary With Libraries" and "Embed Frameworks". Noting that none of the frameworks listed under "Embed Frameworks" were ones managed by Carthage I removed the framework in question from "Embed Frameworks". I then re-built my project and everything works fine including the functionality enabled by the framework in question.
This issue arose for me after adding a second part of the Fabric suite of SDKs to the app.
What actually happened was that the GoogleUtilies Framework was added twice to the Pods project
This would have been fine prior to Xcode 10 but Xcode 10 will complain if a file has two actions against it (in this case a copy action).
It's safe to remove the second framework.
there are some reasons that cause this error to be shown.
1- the project name is the same as a dependency that is used on the project
this error may happen when you choose a name for your project that is the same as one of the dependencies that you use on the project for example you cannot choose FirebaseAuth or GoogleSignIn as the project's name if you use them via pod or SPM.
to solve this problem you should change the project name with the following way:
choose the project from project navigator on the left sidebar, change the project name from the file inspector -> Identity and Type -> name from the right sidebar.
after you change it, XCode asks you to change all relative targets and just press rename.
2 - duplicated info.plist on the Copy Bundle resources portion
you may face this error when info.plist is added to Copy Bundle resources unwanted, choose project form project navigator -> choose target -> goto Build Phases tab -> Copy Bundle Resources and if you see info.plist there, remove it by choose info.plist like the following image
3 - pod files do not work well
sometimes you got this error because the dependencies that you use break for unexpected reasons.
1 - Delete Podfile.lock
2 - Delete Pods directory
3 - Delete Derived Data & Clean (you can find this directory from XCode menu -> Preferences... -> Locations -> Derived Data and go to the directory by clicking the arrow icon at the right of the address)
4 - Exit Xcode
5 - Update CocoaPods with [sudo] gem install cocoapods on mac terminal
6 - goto the project directory on the terminal and run pod install
7 - Open workspace and build
5- duplicated Core data
you may face this problem when you use Core data on the project
first I explain coreData codegen types:
**Class Definition: ** Choose Class Definition when you don’t need to edit the properties or functionality of the managed object subclass and properties files that Core Data generates for you.
Category/Extension: Choose Category/Extension to add additional convenience methods or business logic inside your managed object subclass.
Manual/None: Choose Manual/None to edit the properties in your managed object subclass, for example, to alter access modifiers, and to add additional convenience methods or business logic.
Choose the Manual/None and check if a copy of xcmodeldata is exist on CopyBundleRecources, remove it.
Well, in my case:
If you create two file with same name, will trigger this error.
Remove the one you recently added, will solve this problem.
Hope this helps.
I had this problem when I had a file with the same name in two different targets. For some reason one of those files I had part of both targets. So basically I had two files. And both of those files belonged to one target.
It makes sense that a target can only have one file name per target, so just unchecking the target member box for the file that wasn't related to the main target fixed the issue.
So the problem I was having is that I had accidentally included the Info.plist in the project settings -> Build Phases -> Copy Bundle Resources for my target.
Steps:
Go to Xcode File
Click to WorkSpace Settings
Build System Select as Legacy Build System
Here is another working solution : (If you are using custom Pods)
Select "Pods" from sidebar as highlights in screenshot.
Click on Build Phase. Expand "Headers" section. There are 3 options Public, Private, Project
Expand Public and check there are duplicate files. Remove it. DONE!!
Unfortunately none of these answers worked for me... here was the error I was seeing:
"Multiple commands produce '/Users/.../.../.../Frameworks/abcdef.framework"
That command depends on command ...: script phase ""
That command depends on command ...: script phase ""
Adding this line to the Podfile and doing a " Pod Install " was the ONLY thing that worked.
install! 'cocoapods', :disable_input_output_paths => true
I really hope this helps someone. I spent hours trying to fix this and finally got it.
Sometimes I just wish Xcode was as efficient as IntelliJ / Android Studio :(
Goodluck!
My error was:
duplicate output file
'/Users/home/Library/Developer/Xcode/DerivedData/myAppName-fawptgabysjowicvpeqydjniuovo/Build/Products/Debug-iphoneos/myAppName.app/GoogleMaps.bundle'
on task: PhaseScriptExecution [CP] Copy Pods Resources
/Users/home/Library/Developer/Xcode/DerivedData/myAppName-fawptgabysjowicvpeqydjniuovo/Build/Intermediates.noindex/myAppName.build/Debug-iphoneos/myAppName.build/Script-32CCC25BF727B592A1784900.sh
I focused on the problem file being GoogleMaps.bundle and the location of that file being in [CP] Copy Pods Resources, and the fact that it specified it’s a duplicate output file (I highlighted them in black above), it's the 4th step below
First create a copy of your project and make sure you first do the following steps on that copy
1- In the project navigator I went to the blue project icon
2- I choose Build phases
3- Under Build Phases I choose [CP] Copy Pods Resources
4- Under [CP] Copy Pods Resources I went to Output Files and underneath there I found the file that ended with GoogleMaps.bundle. I selected it and pressed the minus sign to delete it. Make sure you go to Output Files and NOT Input Files
5- I did a clean shift+cmmd+k and afterwards when I built the project the error was gone
The odd thing was even though the red error went away the yellow warning was still there but it worked :)
I had bunch of Multiple commands produce warnings - not limited to info.plist duplication in one target. Including localized resources and string files, headers etc.
Solution: remove all duplications in target membership.
Try all this option anyone of this 3 option will work for you, for sure
Option 1: Remove all files from
Target >> Build Phases >> Compile Sources
Target >> Build Phases >> Copy Bundle Resources
Option 2: Change the build system
Xcode->File->Project Settings-> Build System -> Legacy Build System
Option 3: remove and update existing pod
pod cache clean PromisesObjC
pod cache clean PromisesSwift
cd [your_project_dir]
rm -rf Pods/
rm Podfile.lock
pod update
I hope this will help you, Happy coding :-)
Go in Project Build Phase and Remove info.plist from the Compile Sources. It will remove that issue and project will be active again.
It's worth noting that this error can be produced after auto generation of CoreData models where the Codegen is not set to Manual/None.
To correct this in Xcode 10 double click on your xcdatamodeId file and select each of your entities and set Codegen to Manual/None under Class in your Data Model Inspector.

Include of non-modular header inside framework module 'GoogleMobileAds' after swift 2 conversion

Good day everyone. So i just migrated to swift 2.0 and am facing this problem as titled: Include of non-modular header inside framework module 'GoogleMobileAds'. 21 occurrences. What I have done so far:
I removed every item on my pod file and reinstalled one at a time. Just before adding the GoogleMobileAds, everything would work and deploy to the simulator. Once I add it in, I see all these errors.
I have tried:
"Allow non-modular Includes in Framework Modules" to "Yes".
I added the "post_install" script for
"'CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES'" to "yes" at
the pod file.
Strange thing was it did work for half a day on the simulator. When i was ready to deploy to device, it stopped working. I decided to reinstall the pods and it doesnt work even on simulator again.
Please help.
Attached some screen shots:
I have faced a similar situation as yours.
In my case, the following steps solved the issue.
Re-installed AdMob SDK after removing it once using command 'pod install'.
*This step may not be needed. I'm not sure.
Added the following line to my bridging-Header file.
#import <GoogleMobileAds/GoogleMobileAds.h>
You might have to create the file into your project manually if you don't have it. The file's name is [Your project name]-Bridging-Header.h for example, MyApp-Bridging-Header.h
You may also need to add the path of the file to your settings of "Objective-C Bridging Header" in "Build Settings" -> "Swift Compiler - Code Generation" like
MyApp/MyApp-Bridging-Header.h
The path is relative from your project root as with your Info.plist File's path in your settings.

Xcode 7 Warning - directory not found for option - iPhoneSimulator9.0.sdk

I have got this warning when upgrade my project:
directory not found for option '-F/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator9.0.sdk/Developer/Library/Frameworks'
How can I fix this issue?
I have cleaned the project but the warning still occurs.
I recently upgraded my project as well and ran into the same thing. This fixed it for me:
https://stackoverflow.com/a/32620919/3279011
Note that you need to edit the properties of the test-project, not your main one (that's what took me a while to process).
Click on your project (targets)
Click onn Build Settings
Use the arrows next to your project name (right above the Basic and All buttons) the change to the Tests target
if the warning is ...for option '-F/... thats Framework Search Paths, delete the stuff there
Clean
Build
Go for it.
I had the same error with Xcode 9.2 and here is my solution:
Click on your project (targets)
Click on Build Settings, Search for “Framework Search Paths”
Under Framework Search Paths, delete the paths and keep the “$(inherited)”.
This might happen when you move the referenced file around.
This is what the screen looked like before deleting

Include Headers from added frameworks on Xcode

I want to work with some frameworks like glew and cg so i manually added
the needed frameworks to my project by right clicking the project -> Add files to ...
and choosing the correct framework. The problem is, when i try to include the header files,
Xcode cant find any of them. I hope this picture will help to understand:
And:
The error given is for the glew framework, but it also happens on Cg.
As you can see on the left, The needed frameworks were added.
Any idea on how i can include these headers?
After trying to add the header files manually i got an architecture error:
I dont know if this is how it should look like.
Thanks!
Before starting, remove the framework and all files you have added while trying to make it work.
Then, you have to add the frameworks in the Build Phases of your target. Then go into Link Binary With Libraries and select your framework from there.
This should do it. Your headers should be available as auto-completion after each #import directive.
If it does not work (it sometimes happens), there are additional steps I can provide to you.
Additional steps:
Go to your project settings, in the build settings:
Complete the Framework Search Paths with the path of your framework
Do the same with User Header Search Path
Then, it should work. If it does not, you will need to add the full path of your header in the #import directive. Example:
#import "/path/to/my/header.h"
Apple's documentation available here states:
In the project navigator, select
your project
Select your target
Select the 'Build Phases' tab
Open 'Link Binaries With Libraries'
expander
Click the '+' button
Select your framework
(optional) Drag and drop the added
framework to the 'Frameworks' group
In my case I have added Framework Search Paths for Target, but it should be added to Project
Also Always Search Users Path should be yes
For those whose autocomplete fails after adding framework.
I used to add frameworks, by going to Build Phases and taking the Link Binary with Libraries option. Now in XCode 6.1, though project was building fine, autocomplete in XCode was not working.
So what needs to be done is:
Remove the already added framework from Project Navigator and also from Link Binary with Libraries.
Add framework to project by simply File -> Add Files to option in XCode.
And auto complete will start working.
In my case, the external framework had been downloaded with Windows and added to the project. Then it was transferred to OSX, where the Xcode project was built and the external framework didn't load properly. I guess it is because Windows changes the framework folder to be a regular folder, which OSX then has trouble with.
Solution for me was to simply download the framework with OSX and drag it into the framework folder in the XCode project.
In my case I had to update a framework version, so I just replaced the .framework in the filesystem and then I got the error you've mentioned in the question.
Removing the framework and adding it back again, playing with the search paths and all the other suggestions didn't help.
Eventually, cleaning the build folder did the trick:
Select "Product" from the xcode menu, hold the option key and click on: "Clean Build Folder".
After that I built and ran the project successfully.

How to make Xcode find file FacebookSDK.h?

It says "FacebookSDK/FacebookSDK.h file not found"
Yet I can jump-to-definition on the #import and it takes me to the file.
And once I added the #import it now knows what FBFriendPickerDelegate is and it now doesn't have an error on that line.
I have the facebookSDK.framework in my project and in the right folder. It's SDK 3.1.
I tried adding search paths to /FacebookSDK and /FacebookSDK.framework and /FacebookSDK/Versions/A/Headers etc. I also tried #import "FacebookSDK.framework/Versions/A/Headers/FacebookSDK.h" and it still says it can't find it. I also tried clean and restarting. I have the latest version of Xcode.
//
// FacebookView.h
//
#import <UIKit/UIKit.h>
#import <FacebookSDK/FacebookSDK.h>
#interface FacebookView : UIViewController <FBFriendPickerDelegate>
{
}
First, you have to remove your FacebookSDK.framework from your Project. Then start over again with these 5 steps. DO NOT re-link the framework.
Go to Build Phases in your Project Target.
In Link Binary With Libraries, click the "+" button.
Click on "Add Other..." button
Browse your FacebookSDK folder. Generally in ~/Documents/FacebookSDK/
Clik on (select) "facebookSDK.framework" and then OPEN.
That's it.
No need to remove anything.
In your project go to: "Build Settings”, then “Search Paths". Look for "Frameworks Search Paths". You probably have something fixed like this:
Frameworks Search Paths: /Users/john/Documents/exampleappxyz
Change it to:
Frameworks search paths: $(PROJECT_DIR)
Voila!.
I tried this but it did not work for me. I had to go into the Build Settings for the project and manually fix the FacebookSDK Framework Search Paths to find the FacebookSDK.
Ok guys, I think i got the answer. Follow the steps given below.
Copy your framework into your project.
Make sure it is under some directory. e.g. $(PROJECT_DIR)/project_name/Resources/Frameworks
Click on the target.
Goto Build Phases→Link binary with Libraries
Add the custom framework by clicking "Add Other"
Verify in the project navigator that the framework exists only once.
Now goto Build Settings→Search Paths→Framework Search Path and make sure that it has the following two things.
(a) $(inherited)
(b) $(PROJECT_DIR)/project_name/Resources/Frameworks.
Not to remind the framework exists inside the Frameworks folder
Make sure that there is nothing in the library search path.
Now click on the project (above target)→Build settings and repeat steps 7 and 8.
Now clean the project and build the project.
Hope it works.
Please remember not to keep any folder names with spaces. If you have kept them, make sure that you provide the correct escape characters.
How to remove facebook sdk links:
For those who like myself improperly added the facebook sdk. to remove the facebook SDK from your project,
check the link inside your frameworks folder, delete any facebook sdk link in there
go into Build Phases -> Link Binary With Libraries and delete any facebook sdk in there
Right click on the frameworks folder and select "show in finder" and delete any facebook sdk in there
Now follow "Fede Cugliandolo"'s steps and re add the facebook sdk
I got this problem today.
It turns out I need to have my Framework search path in all three places:
1) Project Build Settings
2) App Target Build Settings
3) UnitTests Target Build Settings
My search path is:
/Users/myusername/Documents/FacebookSDK
After ensure that, the error disappeared for me.
I use xcode 5 and when add sdk it not correct write self address in "project.pbxproj".
Instead local address for sdk it save global address.
I open "project.pbxproj" and finde the places of it and leave address only for sdk in project.
<project name>/src/external/facebook
<project name>/src/external/testflight
to edit the entry was as follows
/Users/<user Name>/myProjects/.../ios/<project name>/src/external/facebook
You have to change the property "Framework search path" in your build settings, and specify where the file FacebookSDK.framework is located (you can then use the SRCROOT variable to point to the root of your project directory, and thus, avoid using absolute paths ;)) e.g. :
$(SRCROOT)/SampleProject/src/Utils/Facebook/
this is normally done automatically by Xcode when you import a third part framework, but it messes sometimes, (eg: when your modify your project directory tree...)
Hope that helps...
besides adding the search path I also had to set the paths to recursive and remove "*.framework" from the "Sub Directories to Exclude" option for this to work.
This happens if you have imported the facebookSDK twice and after having deleting some files.
For example, I imported the facebookSDK in $project/framework but I deleted it for some reasons. Then I imported it via ~/Documents/FacebookSDK but Xcode kept the old folder and search in it by default.
I have to remove all references and files of the old import to resolve my issue.
I ended up checking my project directory, remove any old references to the framework file. Then, remove it from Build Phases/Search paths. Also remove the linked Framework. Restart Xcode, and do the process over again: drag Framework to Frameworks, don't copy in. Check the Build Phases/Search paths. include "#import ". Finally worked. Whew.
Follow the instruction
At step 4 Configure your Xcode Project
I think you missing something. Delete the Facebook.sdk in your project and try again.
I had the same issue when I updated XCode, but in my case I didn't want to make any manual changes to the project settings as I use CMake to create it. You can find the way I fixed it here: https://stackoverflow.com/a/25564152/525873
it is simple, you have to remove your FacebookSDK.framework from your Project.
Go to Build Phases in your Project Target.
In Link Binary With Libraries, click the "+" button.
Click on "Add Other..." button
Browse your FacebookSDK folder.
Generally in ~/mohit/Documents/FacebookSDK/
Clik on (select) "facebookSDK.framework" and then OPEN.
Now copy this Target settings > framework search path into Project setting > framework search path.
None of all answers above worked for me.
What finally did the trick for me was to change the structure of the plugin folder:
Create folder: com.phonegap.plugins.facebookconnect/FacebookSDK
Copy all content from:
com.phonegap.plugins.facebookconnect/FacebookSDK.framework/Headers
to com.phonegap.plugins.facebookconnect/FacebookSDK
Copy com.phonegap.plugins.facebookconnect/Facebook.framework
to com.phonegap.plugins.facebookconnect/FacebookSDK
And finally, change
#import <FacebookSDK/FacebookSDK.h>
to
#import "FacebookSDK/FacebookSDK.h"
The only solution I found was:
Remove the phonegap plugin: ionic plugin rm phonegap-facebook-plugin
Clone the next plugin git clone: https://github.com/jeduan/cordova-plugin-facebook4.git
Add the plugin manually: cordova -d plugin add PATH/cordova-plugin-facebook4 --variable APP_ID="*****" --variable APP_NAME="*****"
Before this a tried to re add FacebookSDK.framework and installed the phonegap plugin facebook through a locally cloned, but the error continues.
Just follow these steps:
Open Xcode's Build Settings tab in your project.
Add ~/Documents/FacebookSDK to the project's Framework Search Paths setting.

Resources