Failed to import bridging header while archiving an IOS app - ios

My Xcode project is able to successfully build and run on a simulator but when I try to archive it an issue comes up saying that the project cannot import the bridging header.
Here is the image app working on a simulator.
Now when I try to archive it onto the generic IOS device I get these errors:
This is the error I get - Failed to import bridging header.
Some of the things we tried include:
Moving the files that are not found from the pods folder to the app folder (get errors with duplicate files - even after we delete the files from the pod folder).
Adding the SDK paths to the Release search path (so its not just in the debug path) - we get the same original error.
Any help would be appreciated, thank you.

I stumbled on this since I had same issue. Here's how I solved it if anybody still interested
Go to your project's settings, "General" tab, scroll down to "Linked Frameworks and Libraries" click "plus" and add all the libraries it fails to import when archiving

Related

No such module while importing my custom framework to the project

I followed this tutorial and also this video to create my custom framework. Once I build it for the simulator version/or both simulator and device, I would like to add this to my project. I just drag and drop it to project:
My PersonFramework within project navigator:
Target membership for my PersonFramework:
Linked Frameworks for my App target.
And finally my try to import this to the project:
No such module PersonFramework.
What am I doing wrong?
FRAMEWORK_SEARCH_PATHS build setting needs to point to the location of the framework.
Close the Xcode.
Go into user(you)/Library/Developer/Xcode/DerivedData and delete the folder contents.
If you have a build of you app in a running simulator you'll need to also delete the build folders.
Reopen the Xcode. Clean & Build.

'Failed to import bridging header', 'file not found', when archiving my project

I was having some trouble when archiving a project with a swift bridging header, and a framework. It was giving me errors, but only when I Archive. So I made a new project to test this further.
Here are my steps:
New swift project.
Add an objective-c file.
When it prompts me to ask about making a bridging header, press yes.
At this point, I archive. It succeeds.
Add ASyncDisplayKit.xcodeproj
Add libAsyncDisplayKit.a, AssetsLibrary and Photos to "Link Binary With Libraries" build phase.
Add "-lc++ -ObjC" to project linker flags.
Add #import <AsyncDisplayKit/AsyncDisplayKit.h> to the bridging header.
These are the instructions found here.
I archive again, and it fails, with two errors:
'AsyncDisplayKit/AsyncDisplayKit.h' file not found
Failed to import bridging header '/Users/Andrew/Desktop/testProject/testProject/testProject-Bridging-Header.h'
This is replicable. I seem to have followed their instructions perfectly well, and I haven't touched the project other than this.
Interestingly, it builds fine, and runs fine. But archiving, it gives these errors.
Any help is appreciated.
EDIT: If I import it using CocoaPods, it works just fine. The problem is that I'm specifically using Submodules, and not CocoaPods, for my project. It'd be pandemonium to switch to using both as a solution to this problem.
This guy has done work to resolve the issue here:
https://github.com/nrcmedia/AsyncDisplayKit
For the time being switching to this branch will get you past the issue.
It is currently under review to be pulled into Facebook here:
https://github.com/facebook/AsyncDisplayKit/pull/449
Did you check under Project Build settings -> swift compiler code generation -> objective-c bridging header is set to testProject-Bridging-Header.h?
I had the problem with a project where I wanted to share a CoreData database between App and Today App Extension and prepare the App for the AppStore (Archive Build).
The reason was that the file '+CoreDataModel.h' was not found and the 'Failed to import brigding header' error message was based on it.
It turned out that the corresponding CoreData classes, which were supposed to be generated by XCode, were built in debug mode, but not in release mode, which is finally used in the archive build.
The crucial difference was that the release build was built in compilation mode 'Whole Module' without generating the CoreData classes.
If you switch to Incremental in XCode under Build Settings > Swift Compiler - Code Generation > Release you could build the app as an archive and upload it to ITunes Connect.

after upgrading to xcode 6, OpenGLES/gltypes.h not found

I'm having an issue compiling my iOS code which was building with the earlier version of XCode.
I import UIKit/UIKit.h in my prefix header file, which with iOS 8 SDK cascades down to including CoreVideo/CVOpenGLESTexture.h, and from there OpenGLES/gltypes.h. In the preprocessor stage, XCode complains that the file gltypes.h is not found.
In the Search Paths for the Target, I've ensured that the Framework Search Paths and Header Search Paths are pointing to the location of the SDK installation. Also, "Always Search User Paths" is set to Yes.
Anyone else seen this issue? "Linked Framework and Libraries" has OpenGLES.framework above "CoreVideo.framework" or any other linked frameworks.
Update
XCode 6 was installed as an update from App Store. Also tried uninstalling XCode (by dragging app to trash), and re-installing from App Store. Did not help.
Update
I removed the prefix header file, and set "Precompile Prefix Header" to "No", deleted the cache where xcode would place the precompiled information. Still no give.
Now where ever UIKit/UIKit.h is imported, this error is thrown.
So here's what I did to get over this:
Quit XCode
Removed all reference to OpenGLES.framework from the .xcodeproj file
Restarted XCode, and opened the project
Deleted all derived data (Windows->Organizer->Projects->Derived
Data->Delete)
Let XCode re-index
I know this was asked some time ago, but I just had the same problem and fixed it.
I was working on an iOS app I inherited, and somehow they added the OpenGLES framework to the root of their source folder, and it was that version of OpenGLES framework that they added to the project as a linked framework instead of the one provided by the SDK.
So I removed that from the "Linked Frameworks and Libraries", and added the one supplied by the SDK. Stopped getting that error after doing so.

Unable to make ipa: Archive Failed

Xcode Project works well in simulator but i am unable to make an ipa.
It showing error while archiving..
Error :Lexical or Preprocessor issue Classes/ViewControllers/QUProgramDetailsController.h:13:9: 'ProgramDetailsDTO.h' file not found and Archive gets failed
can any one please help me?
Ensure the Framework and all it's headers are imported into your project properly.
Also in your Build Settings set YES to Always search user paths, and make sure your User header paths are pointing to the Framework.
Finally, Build->Clean and Restart Xcode.

Could not instantiate class named MKMapView

I may be doing something really stupid here as I've done it before and it worked and now...
Created a new iPad project, in the details view I added a MKMapView, added the MapKit.framework to the project, added the property / etc. to the header. Go to run the project and get a SIGABRT with
****Terminating app due to uncaught exception 'NSInvalidUnarchiveOperationException', reason: 'Could not instantiate
class named MKMapView'**
I found http://mithin.in/2009/06/22/using-iphone-sdk-mapkit-framework-a-tutorial/ but, like I said, I've already added framework. What am I missing?
I ran into this too, but I was able to get past it by following the instructions of step 2 in your link (thanks, by the way):
Add the MapKit framework to the project. (Control + Click Frameworks
folder -> Add -> Existing Frameworks)
I just searched for MapKit.framework, added it to the project, and the error went away.
I haven't added any map code yet (although I do have a MapViewDelegate connected in IB), but it's working fine so far!
Click on your project to bring the project settings. Under Targets, click your project, select from the upper toolbar "Build Phases". Under "Link binary With Libraries" tab, you will see the list of frameworks included in your project. Click the "+" button and add MapKit library from the shown list to your project.
For Xcode 6.1:
Select your project
In general tab, look for Linked Frameworks and Libraries (last one)
Press + button
Search MapKit.framework
Finally add
Easy way!
Works above Xcode version 7.2
As far as I'm concerned selecting the MAPS from capabilities will automatically link your framework to your project all you have to do is check the Maps button in Capabilities -> Maps.
Heres the attached screenshot. Cheers!!
For xCode 4.2:
Click on your project name ->targets ->building Phase ->link binary with library
-> click on + sign ->select mapKit.framework ->click add
I noticed that I was getting this message (on top of the original one mentioned in this post) when I was building and running on the simulator:
ld: warning: ignoring file
/Users/peter/programming/iPhone/iNspector/MapKit.framework/MapKit,
file was built for unsupported file format which is not the
architecture being linked (i386)
Then I just connected my iPhone, build and ran on the device, and the map worked.
So it seems that the MapKit framework cannot be compiled on the 386 architecture, it needs the device.
In regards to #futureshocked's input, I also came across the
Id: warning: ignoring file /blah.../MapKit, file was built for unsupported file format which is not the architecture being linked (i386)
issue.
**Check to make sure you didn't copy the MapKit framework into your local project directory when you added it to your project. I accidentally did this and XCode was giving me the above error. So I removed it from my project directory (in Finder), recompiled, and everything was normal again.
If you don't have the Framework in your project, go ahead and re-link as stated in the answer above.
Found a good tutorial on getting started with MapKit:
http://www.youtube.com/watch?v=X-3jM24EIGM&feature=related
I also received this error when trying to deploy to my 5.1 phone (with XC 4.5), even after changing my deployment target to be 5.1. Looks like the maps update wouldn't fly since I still had Google Maps on my phone. After updating my phone's OS, the exception disappeared.
Please import the WebKit at your Build Phases.

Resources