iOS : Could not build module <framework-name> - ios

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.

Related

Build error Xcode 10 - Multiple commands produce

I just upgraded to Xcode 10, and I suddenly face this error when I try to build, any ideas how to fix it? I tried cleaning derived data, but without any luck.
If you use CocoaPods, click Xcode menu file -> Workspace Settings , And click Build system choice Legacy Build System
If you not use CocoaPods, same of top , select Project Settings
If your app is generating the error related to the multiple .app files just like mentioned above in question then removing the .plist files from "Copy bundle Resources" WILL NOT WORK.
If the error is related to .app file then follow the following steps.
Select the Target.
Go to Build Phases tab.
Remove the items listed in Output Files
Compile the code if it compiles successfully then not follow the next steps.
If code does not compile successfully and Xcode may give you an error related to "Library not found". Then add the missing library in General Tab in Linked Frameworks and Libraries that Xcode mentioned in the error.
Keep adding these libraries (that Xcode ask through compile errors) in Linked Frameworks and Libraries until the code compiles successfully.
Hope this helps.
You can try to change the build system to Legacy,
File > Workspace Settings > Build System > Legacy Build System.
I also faced this issue in xcode 10 but it was because of adding the same framework in main project + other extensions (watchkit or siri extension etc).
I added ObjectMapper in podfile for my main project + for my extensions. When I compiled it gave me an error that multiple command produce and also shows me which framework is causing this issue. Now its working fine for me as I've removed it from my extensions I wasn't using it in my extensions.
Don't know about your issue may be you can check your podfile.
If this is CoreData related. The issue is that you are trying to generate the NSManagedObject subclass but you need to set the 'CodeGen' option to Manual/None. This option is defaulted to Class definition and this would regenerate the code thus creating this issue.
i encountered this issue as well while working with CoreData.
in my .xcdatamodeld file, it came down to the fact that, during the creation of my various Entities, i had copy and pasted one multiple times (thinking i was saving time because various properties were similar enough that i thought this was a good idea).
the resulting Build error Xcode 10 - 'Multiple commands produce' occurred because i forgot to check and make sure the new Entities were set to their own unique corresponding class to match the new Entity in the Data Model Inspector pane.
unfortunately, it took me two days to figure out the original Entity's Class Name was still in place.
so lesson: careful when you copy/paste/duplicate Entities in CoreData.
(... i guess :0} )
some time saver. oops! hope this helps someone.
I had this same issue with Core Data entity class. I had forgotten to select Codegen Manual / None because I do not allow mine to be autogenerated. So I had a class in place and also it was trying to generate one.

Xcode Cocos2d error

I'm observing a problem in the implementation of Google admob framework within my project, which is one of these files giving me this following error "Duplicate interface definition for class GADInterstitial", the problem is that I only have one file of this one, I didn't insert #include anywhere but always #import, I tried to delete DerivedData files and I also changed the bundle name to the project but no one of these attempts has solved the error, nevertheless I have another same project (with a different name) with same classes, settings, etc... and there works perfectly! So I wanted to know, is it possible that the Google framework could go in conflict between the two different projects? In that case what can I do?
try adding GADInterstitial class files in your second project.
got to project -> target -> build phases and check for copy bundle resources . check that there is no duplicate files.
If you have renamed any header file then do this
1)Clean project(s)
2)Delete the "Derived Data" (Organizer > Projects tab, select the project and click Delete)
3)Restart Xcode
4)Build
hope this help you.

Intermittent Swift Framework Compiler Error

I am trying out Swift in the XCode beta. In particular using an #IBDesignable and #IBInspectable. I am building a framework containing an (#IBDesignable) UIView subclass and a Simple iOS App in order to test it out (Both contained in and linked via a workspace). After a few successful builds I get the following error in the framework build output:
:0: error: /Users/richardpj/Projects/Swift2/Swift2FW/build/Swift2FW.build/Debug-iphonesimulator/Swift2FW.build/unextended-module.modulemap:2: umbrella header 'Swift2FW.h' not found
:0: error: could not build Objective-C module 'Swift2FW'
Before you ask I've done a clean and deleted my derived data but nothing seems to resolve it except deleting and recreating the workspace and project files.
Any ideas on the source of the error, how to replicate (for a bug report) OR am I being dumb.
EDIT: I've gotten 50 views since this was posted. Sounds like it's a bug I should report. Any ideas on how to do that?
When making my own swift framework I got the error "could not build Objective-C module".
I fixed it by going to "Link Binary With Libraries" and adding "UIKit".
In case if you are writing embedded framework in Swift check your Project Settings -> Framework Target Name -> Build Phases -> Headers. Currently (Xcode 6.2) any header file listed in Public section here can cause this error:
<unknown>:0: error: could not build Objective-C module 'YourFrameworkName'
I was seeing this error when the .h umbrella file had the same name as one of my swift files. Once I changed the name of the swift file the framework built.
Ex. Project Name: TestProject
|_
TestProject.h <=
|_
Models
|_
TestProject.swift <=
Having the two files with the arrows ( <= ) named the same caused the "could not build Objective-C module" error for me.
In my case I had a previous build setting that overrode Public Headers Folder Path (PUBLIC_HEADERS_FOLDER_PATH) . Clearing that to the (new?) default value of $(CONTENTS_FOLDER_PATH)/Headers fixed the error.
In my case, all I had to do was open the "Edit Scheme" window (Product > Schemes > Edit Scheme) for the embedded Swift Framework target and uncheck "Shared". I guess because non-embedded Swift frameworks aren't yet supported, sharing a framework scheme implies there must be an Objective-C component of the module.
You can also uncheck this in the "Manage Schemes" window (Product > Schemes > Manage Schemes...).
After coming across this problem many times and sometime resorting to recreating the whole project I have found that this very strange build problem is normally caused by you having Breakpoints set.
Open the Breakpoint Navigator Window (CMD-7) and delete all the breakpoints.
This normally fixes this problem for me however bizarre it may sound.
It's very easy to accidentally add a breakpoint when you're clicking in the margin to investigate compilation errors.
I don't know if this will help anybody else but I had imported the ProjectName-Swift.h file into the ProjectName.h (umbrella header) file during some testing, and when I removed that import the error went away and I was able to build again.
In my case this turned out to be because I had failed to list the framework as a dependency in the build phases of my other target(s). As soon as I did that, all was well.
I presume that it is because this ensures that the framework is build before the target(s) that use it.
The reason this issue is intermittent is evidently that, without the dependency, the order of building is indeterminate — so sometimes it happens to be the right order and the build works, and other times it happens to be the wrong order and the build fails.

library linked but Xcode says "file not found."

This just started happening with my project and I have no idea what to do.
I've been using the Parse framework and everything has been fine so far. But now, even though the library is included:
and linked:
I still get a "'Parse/Parse.h' file not found" error when I import it into classes. Even weirder (at least to me), the project still builds and runs. When I build or clean the project, the warning disappears, but then it reappears right away.
Any idea how I can fix this?
For all who have not found issue:
Go to Build settings and search for "Framework Search Paths", then remove everything and put ./ and make it recursive (by double-clicking on it)
IMPORTANT - Don't download Parse framework on Windows and then copy to Mac! inside framework there are some links and while copying they get corrupted. Download the framework directly from Mac and when added to xcode make sure it has "Headers" folder under it in XCode frameworks.
I hope it helps some people.
have you tried by changing the #import "Parse/Parse.h" to #import ?
The compiler will search for the header files in a special search path. In your case, it seems that the file "Parse/Parse.h" is not in your compiler's header file search path. Check this in your compiler settings.
How many targets do you have? If more than one, maybe the debug target doesn't include the framework.
I have the same problem when I use the demo called "TodoTable", and I solve this by deleting the link in target -> Build Phases -> Link Binary With Libraries -> Parse.framework, and then, adding it again. You may do it by clicking + button, and choosing Add other..., then, in the project folder, you can find the Parse.framework file. After that, rebuilding your project, and it will be ok.

Framework import issue in xcode

Here the problem: For a project at work we need to include an extern API: mobileAppTrackeriOS from HasOffers.
It gives us a framework to include in our projet and instruction to enter in our code.
So I copy the framework in the project directory and drag it into xcode to include it.
But when i want to use it with:
#import <framework/mainheader.h>
The build give me an error :
Lexical or Processor issue 'MobileAppTrackeriOS_arc/MobileAppTracker.h' file not found
I check the framework search path in my target build setting, my main directory where is the framework is here.
I test with "" instead of <> same issue...
i cleaned and rebuilt, try to include directly the header... many ridiculous things... no changes.
So what I forget?
I'm on Xcode 4.5 and develop for iOS 6.0.
A question, can you see if the framework is in Build Phases -> Link binary with Libraries?
If answer is not, you must add in this section.

Resources