Failed to emit precompiled header for bridging header - ios

I downloaded a project from GitHub, then pod the following files, some of which are written by OBJ-C and I used a bridge header.
pod ‘SnapKit’
pod ‘MJRefresh’
pod ‘Alamofire’
pod ‘Kingfisher’
pod ‘MBProgressHUD’
pod ‘pop’
pod ‘EVReflection’
pod ‘StreamingKit’
pod ‘iCarousel’
pod ‘ReflectionView’
When I run the project with Xcode 9.0 beta 2, but unfortunately the error log as follows :
error: failed to emit precompiled header
'/var/folders/kd/4gh0_kxx3jx4thjb_sssmmcw0000gn/T/EvoRadio-Bridging-Header-97bd5f.pch'
for bridging header
'/Users/ringo/Downloads/EvoRadio-master/EvoRadio/Resources/EvoRadio-Bridging-Header.h'
I have googled, but no such issue.The error means it needs a PCH file?
This is my .pch header configuration:
It can't solve it.
How to make it?

I have tried all of the above steps mentioned in the answers but nothing worked for me, the problem was basically with the deployment target version for the project and in the podfile.
In my project deployment target was 10.0 while in my podfile it was 11.0.

Note this can also happen if your bridging header imports Objective-C code that itself imports your app's Swift module via myproject-Swift.h. The solution is to use forward declarations for your Swift types and import the project Swift module in the .m file.
#class MySwiftClass or...
typedef NS_ENUM(NSInteger, MySwiftEnumType)
MySwiftEnumType is the lowest level name even for classes. So Swift enum MyClass.MySwiftEnumType becomes just MySwiftEnumType

Make sure you're opening the proper project workspace, otherwise, the Podfile may not have all the resources it needs to compile.
I saw this same error on a project that had been working fine previously.
I discovered that I had accidentally opened the ProjectName.xcodeproj file rather than the ProjectName.xcworkspace file. Opened the xcworkspace file and presto, project was working again!

I also got exact same issue (Xcode9 beta 6) after I added cocoa pods for Encrypted Core Data.
This is my PodFile:
# Uncomment the next line to define a global platform for your project
platform :ios, '9.0'
pod 'EncryptedCoreData', :git => 'https://github.com/project-imas/encrypted-core-data.git'
target 'Root' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
# Pods for Root
target 'RootTests' do
inherit! :search_paths
# Pods for testing
end
target 'RootUITests' do
inherit! :search_paths
# Pods for testing
end
end
Solution:
1 I added $(inherited) non-recursive to Search Path -> Header Search Paths
2 Then added ${PODS_ROOT} recursive to Search Path -> User Header Search Paths
Both the above in my projects' target build settings.
Please have a look at these SO answers:
1 Inherit Header Search Paths
2 Inherit User Search Paths

For me, this problem occurred when I added new build configuration and scheme to the existing project.
The solution was to run pod install on newly created scheme. After that, project was built successfully.

I had this issue just when compiling for a simulator not for a hardware device. There were two compile error like:
error: failed to emit precompiled header 'Bridging-Header-97bd5f.pch' for bridging header 'Bridging-Header.h'
Could not find ActionSheetPicker_3_0/ActionSheetPicker.h in Bridging Header (but it was declared there)
After hours of research and try and errors it turned out, that there was no valid architecture set in the project to compile for simulators.
At Project -> Build Settings -> User-Defined -> VALID_ARCHS add the architecture x86_64 to enable compilation for simulators.

XCode can build seccessful in the some target, but the other target can not.
Finally, I found that Header Search Paths is not the same. (Path: Target > Build Settings > Search Paths > Header Search Paths > add item)
I copied & pasted the path from the successful target. I made it. Bravo.

You can try this solution. I have solved the same problem by this way.
Product > Scheme > Edit Scheme > Select "Build" on Left Menu > Find implicit dependencies
Under the build tab, check 'Find implicit dependencies':
Then make a clean and build again.

In my case I had the same compiler error with additional errors like "Unknown type" in one of my project files, So I just added this to the problematic file, and it solved it instantly.
#import <UIKit/UIKit.h>

My experience with this is that Xcode is unable to find header files for pods/frameworks imported in the project.
My Project experience with this:
Updating Xcode9.2 - 9.3 where many cocoapods had to be updated due to implicit definitions now unavailable or being outdated.
I had changed the Podfile to now include 'use_frameworks!'. Following this and after dealing with other compile issues I found the error you are experiencing. I believe adding 'use_frameworks! was preventing some pods with support prior to iOS 8 from compiling correctly. Steps I took to correct this issue:
I tried deleting the Pods/ directory using cocoa pod deintegrate
I then open project with Xcode and cleaned the build folder and the project. (delete content within derived data folder)
I then pod install again but the issue persisted.
Ultimately I removed the use_frameworks line in Podfile and then repeated steps 1-3 and the project was now able to find the missing header files and the issue never presented it self again.

In my case;
Under Target/Build Settings/
Product_Name section was different than $(TARGET_NAME)
When I changed it $(TARGET_NAME), it was resolved.

In my case, I found that it was because I did not config the Framework Search Paths in Release Tab. Here is the screenshot:
After adding this path, it works.

For my case I had a typo in folder name "Supporing FIles" instead of "Supporting Files".

I also suffered from this after I updated new Xcode. After several hours of investigation, i found that if you have multiple targets, you now have to add more targets in pod file in Xcode 10. So your code should be like this:
platform :ios, '9.0'
target 'EvoRadio' do
pod ‘SnapKit’
pod ‘MJRefresh’
pod ‘Alamofire’
pod ‘Kingfisher’
pod ‘MBProgressHUD’
pod ‘pop’
pod ‘EVReflection’
pod ‘StreamingKit’
pod ‘iCarousel’
pod ‘ReflectionView’
target 'EvoRadio2ndtarget' # add your second target
end
I found that in Xcode 9 you don't need to add, but in Xcode 10 you need to add this. Hope this helps.

Deleting Podfile.lock and re-running pod install fixed this for me.

There are so many reasons and things can do, like:
Restart Xcode, Clean, Build
Remove Pods directory and pod install
Check the missing file is added to your pod file
Check the missing file is added to you bridging header
Change the header settings like here iOS - Build fails with CocoaPods cannot find header files
The only one works for me is the accepted answer in Xcode 9 - failed to emit precompiled header.
platform :ios, '11.0' in podfile should match the target in the project

I had same scenario, make sure for the file A that you have included in YourProjectName-Bridging-Header.h
if it uses some other class(s), then those other classes are also included before that File A

In my case, I was building with the wrong scheme (Top-Left menu).

For Xcode 11 I had an issue with the "Security.framework". I removed this dependency, then re added it. Ultimately fixed the other problems

I got this error after renaming the existing Xcode project configuration in which I had another Xcode project imported.
To fix it, you have to rename the same configuration in the imported project as well.

Since I have been stuck in this issue for 2 working days , I would like to share my issue for you because may be future searchers are facing my problem
I was getting the mentioned error when running with command line , and I found that the command I was writing was for running .xcodeproj ,, but to run a .xcworkspace you have to write the following command
xcodebuild -workspace PROJECTNAME.xcworkspace clean archive
-archivePath build/PROJECTNAME -scheme SCHEMENAME

In my case, all was good. I had just forgotten to add '.h' in import added to the bridging header file
Was
import 'Test'
Required
import 'Test.h'

Had this error in a bit different situation. Added SWIFT file in one project from another one. Checked names of bridging headers, routes - nothing helped. The reason of the error was that I did not import some of my custom classes in the bridging header. Imported - and it worked!

Related

ld: framework not found Alamofire 5.0 [duplicate]

I'm trying to add a framework to my IOS project but when I build I always got the same message :
ld: framework not found Pods
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I tried to remove my Pods directory and then run pod install
I open the .xcworkspace like it is written in the logs on the pod install, I clean the project on xcode and then try to build but it won't works..
My podfile looks like this :
xcodeproj '/Users/guillaume/project/Mobile/iOS/FoodPin/FoodPin.xcodeproj'
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
use_frameworks!
pod 'SwiftHTTP', '~> 0.9.2'
My version of xcode is 6.3.1
Thank you,
In Project Navigator in the folder Pods I had a Pods.framework in there which was red. It was also present in Linked Frameworks and Libraries. I removed both references and the error disappeared.
TL;DR
Remove Pods.framework in:
Folder named Pods
Linked Frameworks and Libraries
This is usually caused by having the .xcodeproj file open instead of .xcworkspace.
When you run 'pod install' for the first time, it will create an .xcworkspace file, which includes your original .xcodeproj and a Pods project. You'll need to close your .xcodeproj and open the .xcworkspace instead.
This is a common issue when creating a project through Xcode's new project wizard - I often forget that I'm not in a workspace, which is required to get Cocoapods to link correctly.
Xcode 9, 10, 11, 11.5
install https://github.com/CocoaPods/cocoapods-deintegrate
pod deintegrate
then
pod install
I cleared this error by deleting the red .framework files that were located in a folder Frameworks in the project navigator. I think this also automatically deleted corresponding red entries in the Linked Frameworks and Libraries section of the General settings.
I have been cleaning / reinstalling pods in order to fix another issue. Perhaps these red framework files and entries were just leftover from a previous pod install?
I had a similar issue as
framework not found Pods_OneSignalNotificationServiceExtension
It was resolved by removing the following. Go to target OneSignalNotificationServiceExtension > Build Phases > Link Binary with Libraries and deleting Pods_OneSignalNotificationServiceExtension.framework
Hope this helps. Cheers.
For who find this issue. I am using NativeScript and got the same error.
That happen becouse I opened the file .xcodeproj, but we must open the project by the file .xcworkspace.
This happened to me after updating my Podfile and doing a pod update.
For some reason, I had a "Pods_[ProjectName]".framework file appear under my project under 'Targets' > General > Linked Frameworks and Libraries.
Deleting this and then clean/rebuilding fixed the issue.
you should delete your project some file as this picture.
I was getting this error because i renamed my project and change the name of project in pod file too but my project was referring to old name which was not there and causing this error . I get rid of this by
pod deintegrate
followed by
pod install
Just Remove your .framework from the list of "Your Project->General->Linked Framework & Libraries".
It's happened to me because I changed the Deployment Target in General but forgot to change the Deployment Target in Pods > General.
[Xcode 11.2.1]
For me it was different app target version in Podfile(platform :ios, '11.0') and in Xcode project file .
It causing Archiving job fail in CI pipeline.
Matching both value fixed an issue! Hope this help anyone.
This issue was driving me crazy as it suddenly happened without doing any changes to the project. I've tried all suggested solutions in this thread (and other related) and none of them solved the problem.
The only thing that differed from my other projects (which compiled fine), was that this project name was containing an accent (a french accent, "é"). I've renamed the project and all related files, and it finally worked !
Maybe this is related to updating to Xcode 10, because this project was working well before...
EDIT : it also seems to failed when using a project with - in project name…
In my case I can build it on devices and simulator but has the same errors when archiving. To solve it, I have to
remove Pods.framework
make sure Pods-<project-name>.framework is embedded
You will find the settings in TARGETS-->Linked Frameworks and Libraries.
In my case, after comparing the difference between a branch I knew built correctly, I noticed this line in my Podfile:
platform :ios, '11.0'
I had inadvertently up'd my target version from 10 to 11 while my targets in Xcode remained set to 10. Reverting back to 10 solved my issue for me.
Ensure your target iOS versions are properly set.
Step 1
The first thing that you will need to do is remove the Podfile, Podfile.lock, the Pods folder, and the generated workspace.
Step 2
Next, in the .xcodeproj, remove the references to the Pods.xcconfig files and the libPods.a file.
Step 3
Within the Build Phases project tab, delete the Check Pods Manifest.lock section (open),Copy Pods Resources section (bottom) and Embed Pod Resources(bottom).
Step4
Remove Pods.framework.
The only thing you may want to do is include some of the libraries that you were using before. You can do this by simply draging whatever folders where in the pods folders into your project (I prefer to put them into my Supporting Files folder).
It worked for me.
Using Xcode 8.3 the accepted answer didn't work for me. I had tried many other solutions but #Elliott Davies answer is what fixed it for me. I'm adding a screenshot for clarity. For some reason, Xcode was trying to link previous podfile setups that no longer existed. All I had to do was delete the extra references and everything worked.
You're more than likely trying to get the pods to work into you project right?
The only way to do so is by creating a separate project that uses CocoaPods.
Close all work-spaces that you are using.
Next, make sure you have your Podfile completely ready to go.
In the command line, wherever your file is, type the command:
pod deintegrate
Then, install your pod agian.
pod install or pod update
Now you can use your project's new workspace to develop from. Look for a file called .workspace. Use that file!
Here is a guide on using CocoaPods
This is the way i fix my problem. and it now work when i writing this answer:
Firstly, i try all the most fix way above,
remove Pods_xxx.framework from the link libraries and framework in target's build phases is helpful, and the issue will disappear, but the coming problem is i can't import the Pods.framework anymore.
And Then, i try to reinit the xcworkspace config, so that i can figure out the real problem. so i run
pod deintergate
and then install my pod again:
pod install
this work prefectly, but the problem is still in there, but i figure out the real problem is the Pods_xxx.framworks not be compiled succeed by cocoapods build script. I think this is the true way to fix the problem.
Finally, i try to edit my project's scheme:
and i add Pods scheme into manage:
and build this Pods.framework separately, and you will find the Pods.framework icon become truly again:
and i think now you have fix your "framework not found Pods_xxxx.framework" problem
but actually i have another problem coming:
so i go to the build setting, and edit the "Framework Search Path" with "${inherited}",
and now all the problems goes out, cheer!!!!:)
After removing and updating pod I still had same issue.
I've found that previous developer put flag in 'Build Settings -> Other Linker Flags' with Framework name (in my case -framework 'OGVKit') that made the issue.
After deleting that flag, project builds properly.
Other thing that solved my problem is to go under Target -> Build Settings -> Other linker Flags and delete the "-framework" and your framework "name".
It happened when i tried to remove a pod.
in my case, my problem was the following: ld: framework not found UserMessagingPlatform.xcframework
for me, the solution was the following:
open a finder window and go to the ios folder
look for the following files:
Pods-[YOUR PROJECT NAME].release.xcconfig
Pods-[YOUR PROJECT NAME].debug.xcconfig
open those files and remove the following text: -framework "UserMessagingPlatform.xcframework" in both files
I did experience this problem because I did not set the platform correctly.
So in my macOS app I had the platform set to:
platform :ios
instead of
platform :osx
In my case, there was a reference to the library I removed on
Targets > Build Settings > Runpath Search Paths
Removing the library from Podfile and updating it obviously didn't remove it, so I had to do it manually and now everything works.
None of the previous answers pointed out the root problem in my situation.
So I hope this may be useful to someone else.
In my case I ended up having to edit my podfile at the root of my project. When I first created my podfile, swift static libraries were not supported.
So I had been using use_frameworks! in my podfile under each of my targets as such:
BEFORE
...
target 'targetName' do
use_frameworks!
pod 'podName', '~> 0.2'
end
AFTER
...
target 'targetName' do
pod 'podName', '~> 0.2'
end
I removed use_frameworks! from my podfile which kept installing the frameworks every time I ran pod install. After removing this line, make sure to run pod install again and remove any of the red .framework references from your Frameworks folder in Xcode. (Though mine appeared differently as attached below.)
Image of Removing .framework files that are no longer necessary
You can also read more about use_framework! here.
I had the same issue after removing some pods from my project.
First I have used pod deintegrate after that pod install in the terminal but didn't work for me.
So I went to the second step inside my project Build Setting and on the Other Linker Flags option, I have found that the deleted frameworks are not removed so I removed them manually.
I have resolved this issue.
delete these three files.
Podfile.lock
Pods folder
.xcworkspace
Then open your project in terminal and run pod deintegrate command, and after then run pod install command
I resolved this issue by selecting the project which downloaded from CocoaPods and built it, you can click Manage Schemes so that it can be appeared in Run bar. Then you can rebuild your project. Hope it help.
I tried every answer on here and none of them worked. I ended up getting it working by upping the deployment target from 10.0 to 11.0. I have no idea why that fixed it, but I suspect it has to do with upgrading to Xcode 10.2.1.
maybe you suddenly open the wrong file of .xcodprj and you should open .xcworkspace

Error "No such module" when import framework in Swift file [duplicate]

I'm currently coding in Swift, and I've got an error:
No such module Social
But I don't understand, because the module is in my project, declared in "Linked frameworks and Libraries" and in "Embedded Binaries".
The frameworks is in Objective-C, so I wrote a Bridge Header for it.
Please, how can I make Xcode recognize the framework?
In case it's Friday afternoon or anytime after 1am:
Opening xcodeproj instead of xcworkspace will cause an error like this...
I'm not sure why this happens, but one way to solve your issue is to go into your build settings and defining the Framework Search Paths to a folder which contains the frameworks in question. If the frameworks are placed in your project directory, simply set the framework search path to $(SRCROOT) and set it to recursive.
Make sure that the naming of you configurations in the sub projects matches that of the "parent" project. If the configuration naming don't match exactly (case-sensitive), Xcode will abort the archive process and show the error "No such module ..."
That is, if you have a "parent" project with a configuration named "AppStore" you must make sure that all subprojects also have this configuration name.
See my attached screenshots.
I am not quite sure why Martin R's answer in the comments for the question is so disregarded:
Make sure that you tried simply skipping import of the framework as it is already added with the bridging header.
Hope this helps
I had the same issue using Cocoapods and Swift. I didn't notice the following lines in the Podfile:
# Uncomment this line if you're using Swift
# use_frameworks!
So, all I had to do was change it to:
# Uncomment this line if you're using Swift
use_frameworks!
...aaand it worked :)
The following steps worked for me.
Quit xcode
Run "pod update" in terminal
Open .xcworkspace and build again.
Please compare this screenshot with your build setting.
It may this work.
Go to the framework search path:
I was experiencing this problem as well. The fix for me was that the Archive schemes between the two projects didn't match. I have an xcworkspace with a framework project and an app project. The problem was that in the Archive scheme for my app, I was using a different Build Configuration than the framework was using for it's Archive scheme. I set both Build Configurations to Release, and that fixed the issue.
In my case, after many attempts to figure out what I was doing wrong importing a framework I eventually discovered that the framework itself was the problem. If you are not getting your framework from a trusted source you should inspect the framework and ensure that it contains a Modules folder with a module.modulemap file inside it. If module.modulemap is not present, you will get the "No such module 'MyFramework'" error.
If the Modules folder is missing the "MyFramework.swiftmodule" folder then the framework will be found but Xcode won't know about its contents so you will get different errors.
No such module Compile error
It is compile time error. You can get it in a lot of case:
.xcodeproj was opened instead of .xcworkspace
module.modulemap or .swiftmodule[About]
Objective-C Library/Framework Target
make sure that generated binary contains module.modulemap file and it's headers are located in Build Phases -> Headers section
Framework Search Paths
consumer -> framework
If you try to build an app without setting the Framework Search Paths(consumer). After setting the Framework Search Path to point to the framework resources, Xcode will build the project successfully. However, when you run the app in the Simulator, there is a crash for reason: Image not foundabout
It can be an absolute path or a relative path like $(SRCROOT) or $(SRCROOT)/.. for workspace
Import Paths
Swift consumer -> Swift static library
The Import Paths(consumer) should point to .swiftmodule
Find Implicit Dependencies
When you have an implicit dependency but Find Implicit Dependencies was turned off
CocoaPods
Check if this dependency is existed in a target
pod deintegrate
pod install
CocoaPods UI Test Bundle
for App Target where used additional dependency from CocoaPods. To solve it use inherit![About] in Podfile
[Recursive path]
Assuming the Framework really is there and in the path, etc... delete the ~/Library/Developer/Xcode/DerivedData/ModuleCache directory (and clean the project and delete the project-specific derived data for good measure).
When you do the standard cleanup, the ModuleCache directory doesn't get rebuilt.
Be sure, that Find implicit Dependencies in Build options in Scheme is on!
There are several potential misconfigurations the issue can arise for,
Please confirm that you have opened the .xcworkspace but not .xcodeproj file. Also make sure you have build Social first before you build TriviaApp.
Make sure that iOS Deployment Target is set same for all modules with main app. For example is TriviaApps deployment target is set to 9.0, Socials deployment target also need to be set to 9.0.
Make sure your main module (TriviaApp) and your used framework (Social) have same set of configurations. i.e. If your Project has three configurations, Debug, Release, ReleasePremium than your Social framework also need to have three configurations Debug, Release, ReleasePremium. Also make sure that the archive configuration is set same for both TriviaApp and Social. i.e. if your TriviaApps archive scheme is set to ReleasePremium, your Socials archive scheme also need to be set into ReleasePremium.
Please assure that you do not need to import Social in each .swift files when its already added in the Bridging-Header.h.
In case of issue came from Pod files, make sure you have uncommented #use_frameworks! into use_frameworks! from you Podfile. Sometime re installing pod works if Social has any dependency on pods.
If none of the above steps works, delete your derived data folder and try re building.
For me Build Active Architecture Only was set to Yes for the selected configuration. This did the trick:
Select "Pods" from the left project navigator > Select "Build Settings" > Build Active Architecture Only to No
What worked for me is this solution to another question. Closing Xcode and reopening the project as workspace. Go to your project folder and open .xcodeworkspace file.
Once you open the workspace (instead of project), Pods should appear as top level project in Project Navigator.
I also encountered the same error a few days back. Here's how I resolved the problem:
The error is "module not found"
Create Podfile in your root project directory
Install cocoapods (a dependency manager for Swift and iOS projects)
Run pod install
Go to Project Build Settings:
Find Objective-c bridging Header under Swift compiler - Code Generation (If you don't find Swift compiler here, probably add a new Swift file to the project)
Drag and drop the library header file from left side to bridging header (see image attached)
Create a new bridging header file: e.g TestProject-Bridging-Header.h and put under Swift Compiler → Objective-C Generated Interface Header Name (ref, see the image above)
In TestProject-Bridging-Header.h file, write #import "Mixpanel/Mixpanel.h"
In your Swift file the code should be:
Import Mixpanel (i.e name of library)
That's all.
Ok, how the same problem was resolved for me was to set the derived data location relative to the workspace directory rather than keeping it default.
Go to preferences in xcode. Go to locations tab in preferences and set Derived data to Relative.
Hope it helps.
I was getting same error for
import Firebase
But then noticed that I was not adding pod to the main target section but only adding to Test and TestUI targets in Podfile.
With the command
pod init
for an xcode swift project, the following Podfile is generated
# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'
target 'MyApp' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
# Pods for MyApp
target 'MyAppTests' do
inherit! :search_paths
# Pods for testing
end
target 'MyAppUITests' do
inherit! :search_paths
# Pods for testing
end
end
So, need to make sure that one adds pods to any appropriate placeholder.
Sometimes pod deintegrate and then pod install helps me, too.
As for xCode 12 and simulators,
the error might disappear when you navigate to Pods.xcodeproj in project navigator,
and in build settings under the 'Excluded Architectures', for every Debug and Release, chose 'Any iOS Simulator SDK' with value arm64.
If you're building for a platform like tvOS, make sure you have an Apple TV (i.e. matching) simulator selected.
Building a tvOS app with an iOS simulator selected gave me exactly this error. Spent the better part of an hour looking for all sorts of build issues... doh.
I was getting the same error as i added couple of frameworks using Cocoapods. If we are using Pods in our project, we should use xcodeworkspace instead of xcodeproject.
To run the project through xcodebuild, i added -workspace <workspacename> parameter in xcodebuild command and it worked perfectly.
In my case the app the IPHONEOS_DEPLOYMENT_TARGET was set to 9.3 whereas in my newly created framework it was set to 10.2
The implicit dependencies resolver ignored my new framework because the requirements of the target platform are higher than the app requirements.
After adjusting the framework iOS Deployment Target to match my application deployment target the framework compiled and linked successfully.
I was having a similar issue with xcode 10.3. xCode was unable to recognise files from pods. Here I have solved this way:
Go to Build Phase
Link Binary with Libraries
Add framework from pods (in my case EPSignature.framwork)
Clean & build the project
Error is gone.
TL;DR: Check your Podfile for target-specific shared_pods
After beating my head against the wall and trying literally every single other answer posted here over the last week, I finally found a solution.
I have two separate targets - one for release and one for development. The development target was created long after the release target, which lead me to forget some setup steps for that target.
I was able to get my project to compile properly using my release target, but my development target was having an issue.
After looking at my Podfile for the twentieth time, I noticed that I only had the following, under my shared_pods definition:
target 'Release' do
shared_pods
end
What I needed to do was add my second target to my Podfile, and that fixed the issue:
target 'Release' do
shared_pods
end
target 'Development' do
shared_pods
end
Hopefully this saves someone a few days of frustration.
Resolve issue of Webview of apple iOS xcode Version 12.3 (12C33)
Simply Do 3 steps:
Open project with .xcodeproj
Quit Xcode
Reopen project from .xcworkspace
All Done
I found that the Import Paths in the Build Settings was wrong for a custom (MySQL) module. After pointing that to the right direction the message was gone.
I fixed this with
Targets -> General -> Linked frameworks and libraries
Add the framework which should be at the top in the Workspace folder. Pain in the arse.
I just deleted my cocoapod. Then, I did a pod install to remove it. Then, I just added it back into my podfile and re-installed it. That made it work. Not sure why.
I had already installed pods. Build worked without any problems when I builded application on my device, but archive didn't work. I just run:
pod install
no new pods were installed, just .xcodeproj file got regenerated and archive started working

Framework not found GoogleToolboxForMac

After I update my Firebase via "pod update", I got error like this :
ld: warning: directory not found for option '-F/Users/bennysantoso/Library/Developer/Xcode/DerivedData/FCM-atfcxuircoryufazlomgwfgmvaqm/Build/Products/Debug-iphonesimulator/GoogleToolboxForMac'
ld: framework not found GoogleToolboxForMac
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Here my Podfile :
# Uncomment this line to define a global platform for your project
# platform :ios, '9.0'
pod 'Firebase/Core'
pod 'Firebase/Messaging'
target 'BB' do
# Comment this line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
# Pods for BB
target 'BBTests' do
inherit! :search_paths
# Pods for testing
end
target 'BBUITests' do
inherit! :search_paths
# Pods for testing
end
end
Does anybody know about this error?
I seek out relationships GoogleToolboxForMac and Firebase, but I just get a little bit of information.
FYI, I use Swift 2.3 and Firebase 3.8.0.
I will be grateful for any help you can provide. Thanks!
I had the same error. Once you install the pods, you'll see the following message.
[!] Please close any current Xcode sessions and use MyApp.xcworkspace
for this project from now on.
I didn't notice this for the first time and was trying to build the project using the regular xcodeproj file. After I saw this message, I opened the right project and it worked fine.
Once you open this project you'll notice that you have two subprojects. One would be your project, and another would be the Pods project.
Framework Not Found
When using Pods, we usually face this issue.
There are two main reasons for this
When we open the .xcodeproj file instead of .xcworkspace as mentioned by izaaz-yunus in this Answer
When Build Active Architecture Only is set to Yes in Build Settings
This applies to the projects target and also to all the targets in the pod project
Main Project Screenshot
Pod Project Screenshot
Select Build Settings (of main project, pod project both)
Select each Target one by one
Set Build Active Architectures to No for each target
Finally clean and rebuild your project.
In my case all integration are well-done and also did try so many time to remove and reinstall pod but did not get success.
Finally try with below step
Projetc->Manage Schemes -> Select check box "Pods-MyProjectName"
And get success.
GoogleToolboxForMac is a dependency of Firebase/Messaging. Details in the podspec. When doing "pod update", Cocoapods should set up your workspace to build and link GoogleToolboxForMac.
It sounds like something about your workspace is in a bad state. Does Product -> Clean help? What about deleting Derived Data and the ModuleCache (Xcode -> Preferences -> Locations -> Derived Data)?
It shouldn't be necessary, but you could also try explicitly adding pod 'GoogleToolboxForMac/Logger' to your Podfile.
its work's
1. select your project in directories
2. select General
3. Add "GoogleToolboxForMac.framework" to the Linked "frameworks and Libraries"
This was fixed by adding $(inherited) in the Build Settings -> Search for LIBRARY_SEARCH_PATHS.
This is understandable, since when updating your pod file for the latest versions of libraries which your project depends on, the debug output tells you where you need to add all the $(inherited) flags:
LIBRARY_SEARCH_PATHS
OTHER_LD_FLAGS
GCC_PREPROCESSOR_DEFINITIONS
Go to : target -> Build Settings -> Other Linker Flags -> remove framework "GoogleToolboxforMAC" and build the project.
I had the same issue when I tried to run it on my device. On the simulator it was working fine. I tried some of the above but it didn't work for me. I checked that I was working on .xcworkspace instead of .xcodeproj file, so I tried this one. Follow these steps to:
Open Xcode project (cocoapods project) using .xc... file.
Select Pods project in the project navigator (blue icon on left).
Under Targets, ensure Pods-ProjectName (blue icon) is selected.
Navigate to Build Settings and set the iOS Deployment Target on which iOS version you are going to run project.
Note:It is same as what you set in Project->Targets->Deployment info->Deployment Target.
Maybe someone get benefitted from this.
If you're facing the same error, in your XCode, go to:
Your Project > your target > Scroll down to Linked Framework and Libraries and check if the Library entry is dimmed:
If so, remove and add it again. In my case, I had duplicated entries and one of them was dimmed (when XCode can't find them on disk).
Closed the project that I was trying to build after I did pod install then opened the .workspace and then everything builds perfectly.
Open the your-project.xcworkspace in your project destination.
1)Open terminal -> 2) $cd /project_destination -> 3) $open your-project.xcworkspace
or just open the file in finder
Make sure your "Build Active Architecture settings" for both your project target and the pod are same. Setting NO in both these cases fixed my issue.
My issue was that I had a /bin/sh script that copied specific Pods which didn't exist. This was one of them. Removing the script resolved the build issue.
-I search in harddrive for the GoogleToolboxForMac files, found in :
/Users/Marco/Documents/iosapps/BomRetiro/Bom Retiro/Pods/Target Support Files
And then i copied the files to this folder :
/Users/YourHomeFolder/Library/Developer/Xcode/DerivedData/Bom_Retiro-bsfjbazzzuwmuidqurdmjvdtnnsb/Build/Products
And then for me is resolved opening the project usinf .xcworkspace file.
For those still having issues after all this.
I am working on a cordova project and the issue suddenly appeared after upgrading to XCode 11.5.
Finally I was able to solve it by opening the pods.json file in the project root and remove the entry in "libraries" which belongs to "FirebaseMessaging".
We were not using that and I dont know how it got there.
Additionally I have changed the "Build Setting" -> "Build Active Architecture Only" to "No" everywhere.
Afterwards I opened the .xcworkspace file again and the build ran through.
Worked solution is
Search GoogleToolboxForMa in xcodeproj
Remove all references from the build configurations
Swift 5 Simple Answer
Shift+Alt+Cmd+K //Clean the project and Run again!
//if not work restart Xcode and again clean it
//Its will work happy coding
Friends, you must be confused with the exact result, as i was. So, i feel to share the
screenshot that might be helpful. We all had to be careful that we need to change the flag for property **"Build Active architecture Only"** for **pod target** to **NO** And build, it would not show the linking error.
See the attached screenshot.
Screen Shot 1, Screen Shot 2, Screen Shot 3
[Select Pods][1]
[Select Targets in the pod][2]
[Change flag to No][3]
[1]: https://i.stack.imgur.com/E7mjX.png
[2]: https://i.stack.imgur.com/wCwET.png
[3]: https://i.stack.imgur.com/KVGKM.png

Xcode: Cannot parse the debug map for .. is a directory

I'm trying to link my iPhone simulator project and I'm getting the following error at link time:
(null): error: cannot parse the debug map for "/Users/admin/Library/Developer/Xcode/DerivedData/TrainTracks-agvvryrtufplkxecblncwedcelck/Build/Products/Debug-iphonesimulator/TrainTracks.app/TrainTracks": Is a directory
Here's the linker output:
GenerateDSYMFile /Users/admin/Library/Developer/Xcode/DerivedData/TrainTracks-agvvryrtufplkxecblncwedcelck/Build/Products/Debug-iphonesimulator/TrainTracks.app.dSYM /Users/admin/Library/Developer/Xcode/DerivedData/TrainTracks-agvvryrtufplkxecblncwedcelck/Build/Products/Debug-iphonesimulator/TrainTracks.app/TrainTracks
cd /Work/TrainTracks/TrainTracks
export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/dsymutil /Users/admin/Library/Developer/Xcode/DerivedData/TrainTracks-agvvryrtufplkxecblncwedcelck/Build/Products/Debug-iphonesimulator/TrainTracks.app/TrainTracks -o /Users/admin/Library/Developer/Xcode/DerivedData/TrainTracks-agvvryrtufplkxecblncwedcelck/Build/Products/Debug-iphonesimulator/TrainTracks.app.dSYM
error: cannot parse the debug map for "/Users/admin/Library/Developer/Xcode/DerivedData/TrainTracks-agvvryrtufplkxecblncwedcelck/Build/Products/Debug-iphonesimulator/TrainTracks.app/TrainTracks": Is a directory
What would cause this problem?
I started off with a Game template (Xcode 7.2.1) and deleted the main story board and AppDelegate.* files since this is an SDL cross-platform project.
This problem was caused by a second inclusion of a TrainTracks folder in my project. I already had a yellow TrainTracks group with all of my source but for some reason Xcode was also showing a blue TrackTracks folder as well. This has a duplicate info.plist and other files. I removed the blue folder reference and the project now builds successfully.
If you are using CocoaPods, and you get this error after changing the name of your Target, click on your target, go to the General tab, scroll down to "Linked Frameworks and Libraries" and then delete the following library:
libPods-YourOldTargetName.a
For me this error was the inclusion of the same .m file twice in the project. Happened while moving some files around. Quit Xcode, clean and it told me the file in a linker error.
I ran into this problem trying to run my tests, and it was because my test target required the use of one of the pods I had in my Podfile. To fix it I just added my test target to the Podfile and included the relevant pods, as per the following pattern:
workspace 'myproject.xcworkspace'
platform :ios, '8.0'
use_frameworks!
def shared_pods
pod 'RealmSwift', '~> 2.8'
end
project 'myproject.xcodeproj'
target :MyProject do
project 'myproject.xcodeproj'
shared_pods
end
target :MyProjectTests do
project 'myproject.xcodeproj'
shared_pods
end
In my case, this same error showed up because one of the frameworks used in the app was compiled without Bitcode, so I had to turn off Bitcode for the entire project.
In my case, I had made a duplicate of one of my .m files in the finder to keep as reference, and somehow (most likely my error) it was added to the project explorer. The real error was duplicate definitions since the class appeared twice. Removing the "ClassNameHere_copy.m" fixed the issue.
For me, it was because I changed my target name which made a new cocoa pods .a library but didn't remove the other from linking.
In My case I had to delete my entire repository and clone again, nothing else worked, after fresh cloning, I ran a pod install and it worked.

Getting error "No such module" using Xcode, but the framework is there

I'm currently coding in Swift, and I've got an error:
No such module Social
But I don't understand, because the module is in my project, declared in "Linked frameworks and Libraries" and in "Embedded Binaries".
The frameworks is in Objective-C, so I wrote a Bridge Header for it.
Please, how can I make Xcode recognize the framework?
In case it's Friday afternoon or anytime after 1am:
Opening xcodeproj instead of xcworkspace will cause an error like this...
I'm not sure why this happens, but one way to solve your issue is to go into your build settings and defining the Framework Search Paths to a folder which contains the frameworks in question. If the frameworks are placed in your project directory, simply set the framework search path to $(SRCROOT) and set it to recursive.
Make sure that the naming of you configurations in the sub projects matches that of the "parent" project. If the configuration naming don't match exactly (case-sensitive), Xcode will abort the archive process and show the error "No such module ..."
That is, if you have a "parent" project with a configuration named "AppStore" you must make sure that all subprojects also have this configuration name.
See my attached screenshots.
I am not quite sure why Martin R's answer in the comments for the question is so disregarded:
Make sure that you tried simply skipping import of the framework as it is already added with the bridging header.
Hope this helps
I had the same issue using Cocoapods and Swift. I didn't notice the following lines in the Podfile:
# Uncomment this line if you're using Swift
# use_frameworks!
So, all I had to do was change it to:
# Uncomment this line if you're using Swift
use_frameworks!
...aaand it worked :)
The following steps worked for me.
Quit xcode
Run "pod update" in terminal
Open .xcworkspace and build again.
Please compare this screenshot with your build setting.
It may this work.
Go to the framework search path:
I was experiencing this problem as well. The fix for me was that the Archive schemes between the two projects didn't match. I have an xcworkspace with a framework project and an app project. The problem was that in the Archive scheme for my app, I was using a different Build Configuration than the framework was using for it's Archive scheme. I set both Build Configurations to Release, and that fixed the issue.
In my case, after many attempts to figure out what I was doing wrong importing a framework I eventually discovered that the framework itself was the problem. If you are not getting your framework from a trusted source you should inspect the framework and ensure that it contains a Modules folder with a module.modulemap file inside it. If module.modulemap is not present, you will get the "No such module 'MyFramework'" error.
If the Modules folder is missing the "MyFramework.swiftmodule" folder then the framework will be found but Xcode won't know about its contents so you will get different errors.
No such module Compile error
It is compile time error. You can get it in a lot of case:
.xcodeproj was opened instead of .xcworkspace
module.modulemap or .swiftmodule[About]
Objective-C Library/Framework Target
make sure that generated binary contains module.modulemap file and it's headers are located in Build Phases -> Headers section
Framework Search Paths
consumer -> framework
If you try to build an app without setting the Framework Search Paths(consumer). After setting the Framework Search Path to point to the framework resources, Xcode will build the project successfully. However, when you run the app in the Simulator, there is a crash for reason: Image not foundabout
It can be an absolute path or a relative path like $(SRCROOT) or $(SRCROOT)/.. for workspace
Import Paths
Swift consumer -> Swift static library
The Import Paths(consumer) should point to .swiftmodule
Find Implicit Dependencies
When you have an implicit dependency but Find Implicit Dependencies was turned off
CocoaPods
Check if this dependency is existed in a target
pod deintegrate
pod install
CocoaPods UI Test Bundle
for App Target where used additional dependency from CocoaPods. To solve it use inherit![About] in Podfile
[Recursive path]
Assuming the Framework really is there and in the path, etc... delete the ~/Library/Developer/Xcode/DerivedData/ModuleCache directory (and clean the project and delete the project-specific derived data for good measure).
When you do the standard cleanup, the ModuleCache directory doesn't get rebuilt.
Be sure, that Find implicit Dependencies in Build options in Scheme is on!
There are several potential misconfigurations the issue can arise for,
Please confirm that you have opened the .xcworkspace but not .xcodeproj file. Also make sure you have build Social first before you build TriviaApp.
Make sure that iOS Deployment Target is set same for all modules with main app. For example is TriviaApps deployment target is set to 9.0, Socials deployment target also need to be set to 9.0.
Make sure your main module (TriviaApp) and your used framework (Social) have same set of configurations. i.e. If your Project has three configurations, Debug, Release, ReleasePremium than your Social framework also need to have three configurations Debug, Release, ReleasePremium. Also make sure that the archive configuration is set same for both TriviaApp and Social. i.e. if your TriviaApps archive scheme is set to ReleasePremium, your Socials archive scheme also need to be set into ReleasePremium.
Please assure that you do not need to import Social in each .swift files when its already added in the Bridging-Header.h.
In case of issue came from Pod files, make sure you have uncommented #use_frameworks! into use_frameworks! from you Podfile. Sometime re installing pod works if Social has any dependency on pods.
If none of the above steps works, delete your derived data folder and try re building.
For me Build Active Architecture Only was set to Yes for the selected configuration. This did the trick:
Select "Pods" from the left project navigator > Select "Build Settings" > Build Active Architecture Only to No
What worked for me is this solution to another question. Closing Xcode and reopening the project as workspace. Go to your project folder and open .xcodeworkspace file.
Once you open the workspace (instead of project), Pods should appear as top level project in Project Navigator.
I also encountered the same error a few days back. Here's how I resolved the problem:
The error is "module not found"
Create Podfile in your root project directory
Install cocoapods (a dependency manager for Swift and iOS projects)
Run pod install
Go to Project Build Settings:
Find Objective-c bridging Header under Swift compiler - Code Generation (If you don't find Swift compiler here, probably add a new Swift file to the project)
Drag and drop the library header file from left side to bridging header (see image attached)
Create a new bridging header file: e.g TestProject-Bridging-Header.h and put under Swift Compiler → Objective-C Generated Interface Header Name (ref, see the image above)
In TestProject-Bridging-Header.h file, write #import "Mixpanel/Mixpanel.h"
In your Swift file the code should be:
Import Mixpanel (i.e name of library)
That's all.
Ok, how the same problem was resolved for me was to set the derived data location relative to the workspace directory rather than keeping it default.
Go to preferences in xcode. Go to locations tab in preferences and set Derived data to Relative.
Hope it helps.
I was getting same error for
import Firebase
But then noticed that I was not adding pod to the main target section but only adding to Test and TestUI targets in Podfile.
With the command
pod init
for an xcode swift project, the following Podfile is generated
# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'
target 'MyApp' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
# Pods for MyApp
target 'MyAppTests' do
inherit! :search_paths
# Pods for testing
end
target 'MyAppUITests' do
inherit! :search_paths
# Pods for testing
end
end
So, need to make sure that one adds pods to any appropriate placeholder.
Sometimes pod deintegrate and then pod install helps me, too.
As for xCode 12 and simulators,
the error might disappear when you navigate to Pods.xcodeproj in project navigator,
and in build settings under the 'Excluded Architectures', for every Debug and Release, chose 'Any iOS Simulator SDK' with value arm64.
If you're building for a platform like tvOS, make sure you have an Apple TV (i.e. matching) simulator selected.
Building a tvOS app with an iOS simulator selected gave me exactly this error. Spent the better part of an hour looking for all sorts of build issues... doh.
I was getting the same error as i added couple of frameworks using Cocoapods. If we are using Pods in our project, we should use xcodeworkspace instead of xcodeproject.
To run the project through xcodebuild, i added -workspace <workspacename> parameter in xcodebuild command and it worked perfectly.
In my case the app the IPHONEOS_DEPLOYMENT_TARGET was set to 9.3 whereas in my newly created framework it was set to 10.2
The implicit dependencies resolver ignored my new framework because the requirements of the target platform are higher than the app requirements.
After adjusting the framework iOS Deployment Target to match my application deployment target the framework compiled and linked successfully.
I was having a similar issue with xcode 10.3. xCode was unable to recognise files from pods. Here I have solved this way:
Go to Build Phase
Link Binary with Libraries
Add framework from pods (in my case EPSignature.framwork)
Clean & build the project
Error is gone.
TL;DR: Check your Podfile for target-specific shared_pods
After beating my head against the wall and trying literally every single other answer posted here over the last week, I finally found a solution.
I have two separate targets - one for release and one for development. The development target was created long after the release target, which lead me to forget some setup steps for that target.
I was able to get my project to compile properly using my release target, but my development target was having an issue.
After looking at my Podfile for the twentieth time, I noticed that I only had the following, under my shared_pods definition:
target 'Release' do
shared_pods
end
What I needed to do was add my second target to my Podfile, and that fixed the issue:
target 'Release' do
shared_pods
end
target 'Development' do
shared_pods
end
Hopefully this saves someone a few days of frustration.
Resolve issue of Webview of apple iOS xcode Version 12.3 (12C33)
Simply Do 3 steps:
Open project with .xcodeproj
Quit Xcode
Reopen project from .xcworkspace
All Done
I found that the Import Paths in the Build Settings was wrong for a custom (MySQL) module. After pointing that to the right direction the message was gone.
I fixed this with
Targets -> General -> Linked frameworks and libraries
Add the framework which should be at the top in the Workspace folder. Pain in the arse.
I just deleted my cocoapod. Then, I did a pod install to remove it. Then, I just added it back into my podfile and re-installed it. That made it work. Not sure why.
I had already installed pods. Build worked without any problems when I builded application on my device, but archive didn't work. I just run:
pod install
no new pods were installed, just .xcodeproj file got regenerated and archive started working

Resources