I'd like to install facebook's pop framework. I have a multi-project workspace which is not using cocoa pods. I want just the simplest, dumbest, quickest install.
From the pop readme:
"... you can add the project to your workspace and adopt the provided configuration files or manually copy the files under the pop subdirectory into your project. If installing manually, ensure the C++ standard library is also linked by including -lc++ to your project linker flags."
I added pop.xcodeproj to my workspace.
I added "pop.framework" to to
the project that needs pop (general > linked frameworks and libraries).
I added "-lc++" to my project linked flags (in the project that needs pop).
Added #import <POP/POP.h> to my .m file.
The result: "POP/POP.h" not found.
I guess I'm doing something wrong, but absolutely no idea where to start looking.
I set the Built Setting of my project, then it worked.
User Header Search Paths = $(SRCROOT) // recursive. Pop is placed in the directory
Always Search User Paths = YES
This setting worked for me:
in podfile:
pod 'pop'
in project > target > build settings
always search user paths YES
add search path:
Take a look at this:
How to add facebook open source code pop to project directly
I also discovered that the -lc++ flag actually caused a linker error. I followed the instructions in that link and removed the flag and everything worked!
You could try this...worked for me as I'm also adding pop as static library, instead of using CocoaPods:
Download source code from this tutorial, because we'll be adding the library files with quotes "POP/POP.h" instead of < POP/POP.h > and all files are already changed here, just copy/paste the "pop" folder from the example project to your project: http://tapity.com/tutorial-getting-started-with-pop/ You can alternatively change all files you already have inserting quotes.
In your project create a subdirectory called "pop" (File/New/Group) with another subdirectory inside called "WebCore". It's important that you create these subdirectories so they will appear as yellow "folders" (instead of blue folders) and Xcode will compile the files properly. You can check if POP files are being included in Build Phases / Compile Sources.
Add the respective POP files inside these empty subdirectories respecting the same structure of the source project (i.e. File/Add Files to "project" inside each subdirectory).
Now just #import "POP/POP.h" and start using pop animations. Doing this way there's no need to add pop.xcodeproj to your workspace.
After trying all of these solutions, what worked for me was actually was lowering the Deployment Target from 9.3 to 8.0.
Be careful of the order of your framework search paths. I had another project which I was referencing modules from that had a different version of the framework library and because that project was higher in the framework search path ranking it was picking up the incorrect header files too.
Those who suffers from it. My problem was like this,
I was having trouble with swift and xcode 8 build times. So i changed my scheme Edit Scheme -> Build -> Find Implicit Dependencies (Uncheck). I was not get trouble with simulator i was having trouble with device. So when i change it to check again it worked. And then made uncheck or vice versa.
Related
I've got Library from another team. I'm trying to use library in our project and while do so getting an error Could not build module 'Common Library' (name of framework)
Below are solutions that I worked on but didn't helped :
1. Delete Derived data content. Clean and Build.
2. Framework is added in 'Link binary with libraries' of Build phases.
3. While adding framework checkmarked : Target and Copy content to folder.
Even I tried this stackoverflow-link but didn't got any break-through!
The only thing that worked was deleting Objective-C bridging header path in Swift compiler - code generation section of build settings in Project.
However, thereafter I'm not able to get Common interface to create instance (i.e. Common dosen't appears in drop-down list)
Below is framework structure.
Any other fix?
you can try delete DerivedData dir.
where is DerivedData?(xcode 8)
go to File > workspace Settings, you'll see DerivedData path.
DerivedData path in xcode 8
Check whether the framework you are integrating is supporting your project architecture.
To see the framework supported architecture, use Terminal and navigate to Framework folder.
use, "lipo -info myFramework.framework/MyFramework"
And, if you want to use the framework files in your project, check whether the files are available in Framework/Headers Folder.
Getting this error :
Try, "file myFramework.framework/MyFramework" in Terminal
I think you does not need to compile CommonLibrary.framework again. So you can try to remove it from Embedded Binaries list. And make sure the path of CommonLibrary.framework is in your Framework Search Paths.
I also had this problem:
1. My 'GoodLuck' framework had two headers: GoodLuck.h and GLAdder.h
2. Project which import this framework couldn't compile
Solution:
Import GLAdder.h in GoodLuck.h, rebuild the framework. It works.
I also had this problem, due to a typo in my GCC_PREPROCESSOR_DEFINITIONS, which therefore invalidated all of my code.
First helpful warning was multiple "Macro Name must be an identifier" followed by multiple "Could not build module" messages.
As this question do not have answer yet, so adding my answer here it may help in future for some another developer.
I know due to privacy you can not disclose the details.
I have used same library and faced same issue so just did did this two things it is working fine.
In General -> Frameworks,Libraries -> CommonLibrary.framework just select that and choose -> Embed Without Signing.
Build Settings -> Search for "workspace" -> Validate workspace -> set it NO
That's it you are done.
From the beginning of my project, I use a custom framework, let's call it "custom.framework". But there was a bug in this framework and now I want to use another version of the "custom.framework".
At first, I simply removed the "custom.framework" file from my project and added the new one. But nothing changed, the bug was still there.
After multiple tries and hours, I understood that Xcode add the old version in memory and used this one instead of the new version. I know it because in the new version I added a method and when I cmd+click the class I've add the method into, it's not there and the file's path is unavailable.
Searching through the web, I tried to change some version parameters to my framework projects: Compatibility version, Curent Library version, Framework version. But this didn't change anything to Xcode which keeps using the old version.
I also tried to make the framework's project as a sub-project and add resulting framework as a dependency to my target. It worked well, but as the framework's project is on a separated remote git repository, I don't think this is an acceptable solution.
So my last try was to build a "custom2.framework", to force Xcode to use the real file and not some cached version. But again, it doesn't work and when building I get errors telling me that all my classes in custom2.framework are duplicated symbols of its cached version of "custom.framework".
So my question is simple: how can I finally tell Xcode to deleted its cached old version and let me use the file I gave him? I already tried to delete my project's derivedData but it seems cached frameworks aren't there.... I'm so desperate :(
Edit: Here are 2 screenshots to illustrate the issue
First screenshot is the path as shown by Xcode when I opened the file from the .framework object in the project navigator.
Second screenshot is the path as shown by Xcode when I opened the file from a cmd+click to a "DCEquipmentManager" in code.
As you can see, the framework linked with the code is not the framework in the project.
it seems problem with binding in new framework, your project still linked with old framework files.
try to remove all files and folder related to your "custom.framework and also remove path for that framework from project setting--> build setting --> search Path
Then after Drag and Drop Your "custom.framework" files in project.
it works for me.hope it resolve your problem.
Please try to clear derrived data:
Window -> Organizer
at the right side you will see projects list. Find your project and tap on it. I the top part of window you will see button delete in front of Derrived data, tap on it.
I guess it will solve your problem.
It might sound silly, but sometimes restarting XCode or the whole machine fix things.
Did you remove the old framework from Build Phases --> Link Binary With Libraries?
Use Clean Build Folder: option-shift-command-K, or select it from the Product menu when holding down the alt/option key.
First lets say something upfront. The build stage is a(are) command line tool(s) that is managed by Xcode according to your Build Settings.
So when Xcode doesn't find your Framework - the Build System will usually also not find it. This forces you to act but may end up in confused Xcode to catch an older reference.
Yes it may happen that the Header Xcode is pointing to is correct but the build system still uses an old copy somewhere. An outdated copy can dangle around literally anywhere depending on the steps you took before.
It (Xcode) assumes where it is located but the Build System still uses another version or the Search Paths just pointing in the wrong Locations even if they are visible to you and even your Framework icons are visible in the lists. So when you erase the last build you actually only force Xcode to rebuild from the known arguments, the settings stay the same, the lists stay the same. Even restarting Xcode does not change anything, the problem persists.
Ergo: Compiler Instructions, Xcode settings and Build System settings don't match what the code tells with #import <NAME/Name.h>
So you will check at least those 6 stages again:
Is your Framework Header File published in your Framework project?
are Build Settings really pointing to the right Framework Search Paths or System Framework Search Paths?
Is your Framework in linking list?
Is your Framework in Embed Framework list?
Does your framework appear in the Framework Group Folder in Workspace/Project Browser? (usually the very last Group Folder in the Browser below all your other files)
Is my Folder Structure correct?
At least 1 to 4 must be right otherwise it will fail.
Here a random list of common causes
Framework is located outside your Source Paths structure
Structure got changed after you added it to the project
You use Workspace's where Framework development and Final Application can appear side by side but you assume Xcode uses this to change its Search Paths
The contained build settings are misleading from former drag and drop operations, ending up tricking Xcode in the "wrong" corner. In this case recreating a project is just one of the possible ways to fix it but not the solution.
Also dragging a Framework into your Project > General or separated in Build Phases > Link Binary list or Embed Framework lists does not make Xcode aware of the wrong Build Settings.
The Linking works, embedding works, but compiling does not. The Header information is still missing.
The solution must be to correct your Build Settings.
As mentioned above Build System and Xcode are two different things. In particular only setting the right Framework Search Paths will solve those issues, even if you managed to kick your derived data manually.
Erasing Derived data?
Derived data is the place where precompiler collects data to compile. So it can be seen as expression of what all the settings are told to do. Erasing it does of course not change the settings but may fix inconsistencies related to former Build Settings. It would erase the derived data and rebuild from the Build System Settings you gave.
Correcting Linking?
Also Linking is not the same as making Xcode aware of the desired Headers. Linking is for your final Product to know where Symbols are to call on them at runtime, it does not change Framework Search Paths and System Framework Search Paths, they stay the same as given.
But it is not wrong to start fixing first with
Product > Clean Build Folder, it forces your build to parse all and compile all again on the next Build.
When the troubles come up because of folder structure in parallel or Frameworks are simply placed outside the Source Directory then you must point to them directly or relative.
Most likely you should place one extra entry in your Framework Search Paths like $(SRCROOT)/../Yourframeworksource/build/Debug. expression to point to relative higher folder structure.
Needless to say that a Release Build likely needs another entry ending in "/Release".Hint: Well you can have different Search Paths for different Compile Schemes..
This works particular good after you cleaned Linking List, Embed Frameworks List and then also check the very last Group Folder "Frameworks" for double entries to drag and drop a fresh Framework reference in there.
How to know if leading /../ will fix it?
Click on the dropped Framework Icon inside the workspace Framework Group Folder (lower most) while your Project is the active selected to work on, now watch for the relative Path information on the very upper right side of Xcode, if there is some /../ you know you need it as well.
Sorting of Framework Search Paths
play a role of course, just the same as #import/#include rule sorting matters.
Remember the first found, first wins rule because often we use #import that works different then #include but ignores second attempts to declare. This leads to once wrongfully declared headers to hide corrected declarations later on in parsing that share the same filename or define rules
#ifndef xyz
#define xyz
// all your code here.
// a second read attempt would be ignored
// a second read is hidden also when you use #include then.
#endif
So you can sort those entries either by code and/or in the build settings if needed because of course it matters what is declared before other declarations depend on it.
As a beginner in ObjectiveC I need some help.
I'm working on a phonegap plugin for IOS (so, written with objective C). I use some open source code but I got an error with an .h import.
My architecture look like:
myFmk.framework/
myFmk.framework/ABCDE/myFmk.h <== in a sub folder
myFmk.framework/myFmk <=== this is a file
myPlugin.h
myPlugin.m
In myPlugin.h I have #import and in "myFmk.framework/myFmk" file I have only one line "ABCDE/".
I thought that this file do a redirection of the absolute import (with brackets) but my complier told me that "myFmk/myFmk.h" is not found.
I tried to find some documentation about this feature but I wasn't able to find its name... do you have this documentation or the feature name?
Thks.
Is the framework added using a cocoapod? If not, did you follow the instructions properly for adding it to your project? It would probably help if you posted the framework you are experiencing problems with.
If this is a framework that is added to your project properly and you are unable to import there are a few things you should check. First, go to your project settings (click on the project at the very top of your file tree in the left column) and then look for "linked libraries". See if the library is listed there. If not click the + and try to add it.
If this framework was added via cocoapods another thing to check is search your file structure for libPods.a. If it is red, I find sometimes it is helpful to delete it, close the project and run pod install again.
Also if you installed the project via cocoapods remember to open the workspace and not the old xcode project file.
I have also experienced this problem when my header search paths and other linker flag paths were wrong. Linker Flags should be $inherited if this is a cocoapod. In my projects most Header search paths are $inherited too.
If none of this is helpful please provide more information such as how this framework was added to your project and what the framework is. Also let us know if you get any error messages.
I want to use facebook pop, but I don't know how to embed it into my project. My project isn't workspace and no cocoapods, I just want to add them directly. Anybody help?
I just did this, so here are stepwise instructions. (Basically, expanding on the README which says: "By adding the project to your project and adding pop.embedded framework to the Embedded Binaries section on the General tab of your app's target, you can set up pop in seconds!")
Clone the library into a directory accessible from your app's project:
git clone https://github.com/facebook/pop.git
Open a Finder window into the newly cloned pop directory.
Drag the pop.xcodeproj file into your app's project navigator, inside your app's .xcodeproj.
Go to your app's project, select your target, select the General tab:
Under Embedded Binaries, add the Facebook pop framework. There are two on the list, one for iOS, the other for OS X. Because Xcode, the names are undifferentiated.
Verify you selected the correct one by looking at the path in the Embedded Binaries section after adding it.
Use the pop framework by adding an #import pop; to whatever view controller you want to use it in.
"... manually copy the files under the pop subdirectory into your project. If installing manually, ensure the C++ standard library is also linked by including -lc++ to your project linker flags."
Do you see that introduction?
I downloaded MapBox example from github using the following
git clone --recursive https://github.com/mapbox/mapbox-ios-example.git
Which downloaded it including all dependencies. Now I'm trying to create a separate project and include MapBox DSK as it was in that example. I tried creating workspace then creating a single view project then add new file and select .xcodepro for the MapBox DSK but didn't work when I tried importing MapBox.h file. I never tried importing 3rd parties API before and a bit not sure how I can do that correctly. Any Idea how I can accomplish that ?
Thanks in Advance
Just try:
#import <Mapbox/Mapbox.h>
instead of just importing Mapbox.h as suggested here:
https://www.mapbox.com/blog/ios-sdk-framework
You simply drag the Mapbox-ios-sdk project file from Finder to the files pane in Xcode.
And then click the project in Xcode files pane, Target-->Build Settings. Search for "User Header Search Paths". Specify where the MapBox sdk is located.
What I do is I put the MapBox-iOS-sdk in my project directory. And I set the path as $(SRCROOT) and make sure to set it as recursive.
While you're at it also make sure -ObjC and -all_load are set in Other linker flags.
That only helps you reference the .h files, to link, also under Build Setting, Link Binary with Libraries you need libMapBox.a.
If there is a MapBox.bundle (as in the latest development branch) in the group and files pane, you want to drag that into Target->Build phases->Copy bundle resources as well. (The add button doesn't work for me.)
I think the best way is to look at mapbox-ios-example provided by MapBox and try to replicate all dependencies into your own project.
A bit late but I did it like it was explained here: http://mapbox.com/mapbox-ios-sdk/#binary.
Not messing around with git, just dragging things into your project, easy!
I think problem here is he couldn't find a specific 'file' that was titled "MapBox.Framework" inside the folder of resources downloaded from Map Box, however what you actually need to do is copy that whole folder, which is titled "MapBox.Framework" into the frameworks section. I think the confusion was that the main folder that needs to be copied doesn't look like the yellow framework icon until you copy that folder into Xcode's frameworks section.