Related
Suddenly it stops building application in device. In simulator its working but when I connect the device and try to run it in device it gives me an error:
Could not build module UIKit
I tries a lot but couldn't solve it.
A full clean + deleting the derived data worked for me.
Be sure to fix any code that may be broken because UIKit cannot be installed, before the clean and build.
So, for example, if you are trying to reference UICollectionViewController, and need UIKit to reference it, comment out the code that is using UICollectionViewController, comment out the import for UIKit.
Then clean, build. Now uncomment import UIKIt, build. NOW uncomment UICollectionViewController code, build again.
Please don't make the same mistake like I did. In my case, I accidentally typed some words into Foundation framework file.
Something that might help would be to set the Derived Data location to "Relative" in XCode preferences, then Clean & Build
For some reason your UIKit.framework is corrupted, either copy a working UIKit.framework from somewhere else into
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks
Or reinstall Xcode the fix the issue.
I accidentally edited the Foundation framework file
so UIKit.framework got corrupted. The only solution is recover the original.
You have two ways to achieve the same:
Just reinstall Xcode. OR
copy the Framework from another machine with the same XCode version and paste into yours.
Location:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks
If you have two Xcode then uninstall both and again install Xcode. It worked for me.
If cleaning the project and deleting the 'derived data' doesn't work,
try to change the 'Deployment target' (at 'General' tab) from 7.0 to 7.1
Check whether the appropriate target is selected or not from the "active scheme selector". Selecting "Generic iOS Device" solved my problem.
Click to select simulator
Select "Generic iOS Device":
Make sure none of the files are edited in the UIKit framework located inside Xcode.
Cleaning Derived data worked for me
Check the tool chains installed and select the right xcode tool chain. In my case i changed it from Swift 4.0 to xcode 9.2 and it worked.
In my case, after cleaning the project, only restarting my Mac helps.
Cleaning the project and restart xCode worked for me.
I am also facing this issue for very long time and after trying all the suggestions given in the different portals, i came to know that the issue is with the device you want to run the application. Device have latest iOS and your Xcode is not supporting that iOS.
For example you have Xcode 7.2 and want to run the application on device which have iOS 9.2.1. So you only need to update your Xcode.
And one more thing Base Sdk in Build Settings is always greater or equal to the software version number on your development device.
Already tried all the solutions above. I still could not solve my problem. So I uninstall the Xcode and reinstall it. It worked magically.hope this helps.
Suppose you have changed or deleted anything in the UIKit framework, then shows this error.
If you are able to find that class or .h file to be changed or deleted, then replace that whole file content in that .h file from other system's Xcode (confirm that should be similar Xcode version).
For example, In UIView.h file - I have deleted a method and closed and opened the Xcode. Then I couldn't reverted that code.
I tried with delete derived data,delete application from project list but when i delete xcode and install new one its working so its best way just delete xcode and install new xcode.
This error happened to me when I accidentally modified the uikit framework. Removing and re-adding the uikit framework in link binary with library, cleaning derived data and restarting xcode didn't work. I don't want to uninstall my xcode so I tried to copy codes of the class that I might have modified from other pc with xcode that works fine and paste it to mine. It worked!
If your project builds for another target (e.g. it builds for simulator and NOT your device), then it's confirmed you accidentally edited one of the header files of the frameworks for that target. The affected framework is the one you are receiving compiling errors for.
It worked for me after remove all folders in DerivedData folder.
My Issue causing this same error was due to working in a workspace created by coco pods, somehow the link to the UiKit Framework had been lost from the original project.
To solve this i just reopened the xCode project not the workspace and re added the missing UIKit framework, saved the project and closed it, re opened my workspace for the project and the annoying nag messages caused by this were fixed. Hopefully this helps someone else.
I had this issue, and I set Device on Generic iOS Device, clean project, make build. Then I switched device to my real device and run project. The error does not appear.
Cleaning some unnecessary Xcode data using DevCleaner for Xcode app worked for me.
My error was a wrong version of command line tools - go to Preferences->Locations and change the command line tools version - quit xcode and try again.
When I run my tests I get an error:
Code coverage data generation failed.
Unable to retrieve the profile data files from 'UIDevice'.
On console was printed warning:
Timed out waiting 120 seconds for simulator to boot, current state is 1.
What is the reason?
If you are integrating your project with a 3rd party dynamic framework, you may need to add a path in your build settings. Look for ->Build Settings->"Runpath search paths" and make sure it includes the path to the framework.
I was just seeing this exact issue myself after setting up my a project to use a framework my team has been working on. After updating this specific setting, the problem went away. In my case, the path was identical to one I already had to set for the "Framework search paths" setting.
I solved this problem, just like I solve most of those XCode Problems:
delete your projects files in your DerivedData (Xcode>Preferences>Locations>DerivedData→ to jump there in finder)
Product>Clean
(keep alt-Button pressed) Product>Clean Build Folder
Quit XCode
Restart XCode
Remove your app from your device / simulator
Try again.
In case it still doesn't work, use another simulator / device for a few runs. Sooner or later it will work again on the original one again.
If you are using cocoa pods, check this thread on the Cocoapods repository:
https://github.com/CocoaPods/CocoaPods/issues/5385#issuecomment-226269847
This fixed my problem:
Copying #dfleming response:
For some reason, it appears that CocoaPods is not adding the "[CP]
Embed Pods Frameworks" build phase to the UI Tests target when
generating the project workspace.
I manually added this in and the UI Tests were runnable again.
This build phase should run the following script: (Replace
{YourProject} with your project name)
"${SRCROOT}/Pods/Target Support
Files/Pods-{YourProject}UITests/Pods-{YourProject}UITests-frameworks.sh"
I experienced exactly the same error and eventually got it working, these are the steps I took.
Tried restarting Xcode and the simulator, after cleaning and deleting the app, that never worked.
Then I restarted the Mac as suggested, but that still didn't work.
Then I chose a new device to test against in the simulator, was previously using 5s and switched to 6, and that worked.
Interestingly, when I switched to the iPhone 6 simulator, it showed the Apple logo with a loading bar, before running the app and working.
When switching back to the 5s simulator it did exactly the same, with the Apple loading bar, which it hadn't done before, and then the 5s worked.
So it looks to be a simulator issue, and switching to a different device worked. Resetting the content and settings may be the solution for a non-working device.
Cocoapods link_with method can cause this issue!
I was getting the exact same error on xcode 7.2 - no number of simulator or device resets seemed to clear it up. After completely rebuilding my UITest targets though things worked fine. After spending a lot of time in a massive git diff of the .pbxproj file I found a solution for my project. Im not sure if it addresses the root cause for everyone who is seeing this error but it definitely clears things up for me.
From the project info below "deployment target", "Configurations" will list all the possible configurations for your application. Expand the configuration you are trying to run and you should see a list of all your targets. In my case cocoapods had automatically added a base configuration for the UITest target:
Set this to none in the dropdown.
Next in the menu to the left select your UITest target then build phases You will need to remove check pods manifest.lock link binary with libraries emebd pods frameworks and copy pods resources.
Finally go to your pod file and check for any mentions of your UITest target or targets. In my case I had been specifying at the top of my podfile:
platform :ios, '8.4'
use_frameworks!
link_with 'My App', 'My UITesting Target'
pod 'A Pod', '~> 1.0'
Instead the podfile should list specific dependencies for each target:
platform :ios, '8.4'
use_frameworks!
target 'My App', :exclusive => true do
pod 'A Pod I want to use in my app', '~> 1.0'
end
Assuming you weren't using any pods in your UITests the target should build again without errors and tests will run!
My understanding of root of this problem is that each UITest target builds two separate bundles, one for the app and one for the UITest controller. Unfortunately cocoapods link_with logic modifies all the specified targets to expect the pods.framework in their bundle. The build phase scripts add the framework to the app bundle but not the UITest controller bundle, so then when you launch your tests that UITest controller bundle appears to be missing frameworks and xcode aborts the installation.
If you were using pods in your UITests you should be able to specify these in the same way:
target 'My UITesting Target', :exclusive => true do
pod 'Another Pod I want only for UITesting', '~> 1.0'
end
And when you run pod install everything should link up correctly.
This problem can also appears when you use Cocoapods with a framework where some dependencies are missing.
For example if you are using Framework A, and this framework depends of Framework B but in the Podspec of Framework A the dependency is not declared.
One of the reasons this can happen is if the host application that the test target is testing is not linked to the right dependencies. For example, if you have are testing a framework, make sure the host app is linked to those frameworks and also embedded.
My problem was caused by incorrect deployment version of unittest target. Tested App deployment version was 7.0, but the unittest's was not set up correctly automatically. It was set to 10.0, while my simulator's version was 8.4. Change the UT target's deployment version to 8.0 in build settings and then all the problems disappeared.
I tried a bunch of these solutions with no luck. I turned off the Code Coverage option in my Scheme's Test section, which suppressed the error but Tests would not run. Then I noticed quite a bit of stuff in NSLog console. Somewhere in there, it mentioned reference to a framework that I was no longer using and trying to load.
I searched the app for it, and Build Settings -> Other Linker Flags was trying to load the framework that wasn't there anymore.
I removed:
-framework 3rd_party_libname
Then tests worked again. This was confusing, but please check for NSLog msgs. I was using XCode 8.3
One or more of your simulators has gotten stuck. The only thing that always works to fix this for me is to reset the simulator content and settings from the Simulator menu.
Note: this will delete all app data from the simulator.
After a long time trying to figure this out, it turned out that I had to create a brand new test target.
Then after rebooting the device the problem no longer resurfaced.
In my case, I had added Swift files to a framework that was (until then) purely Objective-C. The test bundle did not have any Swift code in it.
Once I added a Swift file to the test bundle, Xcode automatically updated some project settings and the error went away.
You should keep the Swift file in the test bundle, even though it may not contain any code. Either Xcode or Cocoapods evidently use the existence of Swift files in the test bundle to determine whether to run the tests in "swift mode".
The root cause is probably the simulator failure. Issues with the simulator are common, especially on first launch.
If the problem occurs even after successful simulator launch and connect, please post the details of the error.
To get the simulator to launch, I often have to cancel the first run (after launching Xcode cleanly), and try re-running a few times.
If this is repeatable, happens on multiple projects, and persists after relaunch and cleaning of the projects, consider submitting a defect to Apple if the Stack Overflow community cannot help.
I had this same problem but it was due to having a test target and renaming the application's target. Make sure you have a valid Host Application set.
Choose the test target on the project page
Under the General tab there should be a Host Application select box
Choose the target you want to test against
I also faced same issue :
Tried following things for different projects :
1.For project where i had some third party frameworks, The problem was that test bundle can't find the framework at runtime. For this update test target's Runpath Search Paths build settings by adding $(PROJECT_DIR)/Frameworks (assuming you keep your frameworks at that location)., It fixed my problem for this project
You can look for it at below location :
Project file -> Test target -> Build Settings -> Runpath Search Paths
In other workspace, When I changed my testing device to some other simulator or change the device itself. it helped.
Restart the xcode or your mac system.
hope it will help u
Carthage users:
This happened to me after I added a new framework to my Cartfile.
I ran carthage update but forgot to drag the .framework file from Finder into the Embedded Binaries section of my app target!
Once I did that, the problem went away.
(Note this is a specific case of the general problem mentioned by #Mustafa above.)
I was having this problem on Xcode 8.3 on Sierra 10.12.4
I opened the Keychain Access application on my Mac
After a few seconds, I got several system pop-ups asking for my password, to grant permissions to Keychain items.
I entered my password into the pop-ups, and then my tests starting working.
Steps that worked in my case
Delete the scheme and clicking Manage Scheme->Auto generate scheme resolved the issue in my case.
Issue was caused by installing the certificate in the simulator and in the keychain
Using Xcode 9.1 with multiple build targets and standard compiler we were working on UI tests and I started seeing this problem. So, you will probably hate me for this answer, and I fully expect it to be downvoted, BUT this actually worked for me: I had to completely remove Xcode and my project from my machine to make this error disappear.
I tried every single suggestion in this thread, some multiple times, tried clearing cache files, deleting derived data, tinkering with build settings, updating podfiles, cleaning, rebuilding after each attempt, cleaning the simulator, manually recreating the simulators in 'manage devices'. After hours and hours of frustration it was still a complete mystery why this machine was failing to build our UI test. It seemed to work fine on other machines and on our CI. In addition to the items in this thread I manually modified the pbxproj file to set all options related to code coverage to "NO".
Finally, I was 1 step away from reformatting the entire machine. I decided to completely remove Xcode following the suggestions here: Stackoverflow: How to completely uninstall Xcode.
Specifically, I trashed our workspace, quit all programs, deleted all of the files listed, cleared content and settings from the simulator, deleted the simulator, turned the machine off for 20 minutes, came back, reinstalled Xcode, cloned the repository, and voila! No error.
Hope that solves the issue for someone. It's the 'nuclear' option, and you should never ever have to do this, but like I said, this is the only thing that worked for me.
I’m getting this error whenever I try to run my app on a device:
"App Installation Failed
Could not inspect the application package."
I realize that this can mean a million things and I have done days of research but nothing has worked yet. It works on the simulator.
What I’ve tried:
Renaming “Resources” folder in the Google pod (only place it existed)
Renaming “Resources” in Finder for Google and changing the path in the pods resource file
Delete derived data (through projects window and deleting the folder directly)
there are no weird characters in the product name (there is a space)
delete derived data, delete app, restart phone, cmd+shift+K, quit Xcode, restart computer
all software is up to date
there are no sample projects from third parties
the “capabilities” in the app match the entitlements in the app id
Other info:
Xcode 6.4
application supports iPhone and iPad (min version latest 8.4)
works every time on the simulator
always fails on the device (tested iPhone 6 and iPhone 5)
builds with out error
there is no run script printed (in “report navigator”) but there is for
the build (again no error)
valid architectures: arm64, armv7, armv7s, x86_64, i386
build valid arch only: Debug-Y, Release-N
This was working fine before and I did a bunch of code changes (not settings) before this happened out of the blue.
Odd but has been happening:
I’ve noticed that no matter how many times I switch the provisioning profile, it always switches back to automatic (kind of annoying but it isn’t my issue)
Fixed it myself. I was importing a framework in my bridging header that I previously removed and Xcode gave me no error I guess because I didn't call the framework anymore?
Steps:
remove the unused/nonexistent framework for bridging header
cmd+shift+k
quit Xcode
find your project's build folder and trash the contents of the Intermediates and Products folders
open your project and run
This may be overkill but it works now. I hope this helps.
For future reader:
Same issue, but different problem.
My problem in Cocoapods configuration.
I have update Cocoapods to latest version in main project, and in this version some configuration path has changed.
So, i need to make sure all my dynamic frameworks that use Cocoapods to be updated in same version to solve this issue.
Note:
My latest Cocoapods version is 1.2.1
Xcode v8.3.2
update -> pod update
In my case it was an accidentally included framework. Just had to remove it.
After successfully compiling the project in Xcode 6, I am unable to run it in the simulator with the above mentioned message. I did all the possible research, tried everything and still no advances.
I am not working with swift, neither I use widgets or extensions, so please do not suggest solutions caused by these as can be seen in similar questions.
If someone found a possible cause (or solution!!) other than these, please help. Thanks
"Reset Content and Settings" from iOS Simutalor menu options and launching simulator after Quitting solved my issue.
Cleaning the build folder resolved the issue for me.
(While holding down the Alt-key: Product > Clean build folder)
I tried every other solution listed here. Well, I ported my project from Swift 1.2 to Swift 2.0. The application was stuck even after a lot debugging and launch services error 0 was reported.
solution: It happens because of framework compilation.
App target -> Build Phases -> Embed Frameworks.
So mark copy only when installing on. Clean the project and run it!
This has now been resolved. The problem was caused by ShareKit library added by CocoaPods for compatibility reasons. After removing the library and all related code, the app successfully launched in simulator. I recommend checking the system log for more details on the issue as to me it pointed me in the right direction (stating the name of conflicting library).
In case anyone has this problem in combination with cocoa pods, these steps helped me to solve this error (after few hours):
run pod cache clean
from SRC_ROOT run rm -rf Pods (optionally rm Podfile.lock)
Click on the Simulator app, click Simulator -> Reset Content and Settings...
Go into Xcode, In the Menu bar click Product -> Clean (or click Shift + Command + K).This will to clean your Xcode project.
Create a new Terminal Shell (From menu bar click Shell -> New Window)
run rm -rf ~/Library/Developer/Xcode/DerivedData/
...then try to Build & Run your project.
Note:
SRC_ROOT can be found by entering the Navigator, clicking on the project, clicking on the project again from the project and targets list, going into Build Settings, scrolling all the way to the bottom to the User-Defined Section, and the SRC_ROOT will be labeled as PODS_ROOT. Take that and copy it verbatum into the Terminal and proceed with step 2 from the list above.
Hope it helps.
I get rid from the issue by the given steps for simulator
1. Way
Reset Content and Settings of Simulator.
Clean your project by Cmd+Shift+K.
Clear your Derived Data.
The last one which is more important change your Bundle Identifier by "com.yourcompanyname.projectname" like "com.facebook.Facebook"
2. Way
You can do only be the given line, it works for me
The last one which is more important change your Bundle Identifier by "com.yourcompanyname.projectname" like "com.facebook.Facebook"
Thanks and enjoy programming.
Might be related to this issue: "This app contains an app extension with an illegal bundle identifier" issue
I had to format the bundle identifiers for my app and extension as follows:
com.company.AppName
com.company.AppName.Extension
First "Reset Content and Settings"
If you didn't fill the build number and fill it and Run.
It's solved for me.
If you change the name of the supplied class InterfaceController set by default when you start a new project. This class is referenced in the Info.plist under the key RemoteInterfacePrincipalClass. In my case, I got the error mentioned by the OP until I fixed the name of the class in there (see screenshot).
If you are here after having issues doing an integration with WatchOS 2.0, go to - ~/Library/Logs/CoreSimulator/[Device UDID]/system.log and if says something like WatchKit 2 app has frameworks; that's not allowed. then follow the link below.
http://zyafa.me/blog/watchos-2-and-embedded-frameworks
Thanks for pointing this out #Miki and kudos to you. I had the same issue as you yesterday (and I added ShareKit 3.0.0 from CocoaPods to the app a few days ago). I suspected ShareKit giving me this problem, but now I can be confident of exactly which library is causing this. Here is what I found in my log (if it can benefit others):
Error Domain=LaunchServicesError Code=0 "The operation couldn’t be
completed. (LaunchServicesError error 0.)" UserInfo=0x7fa836097aa0
{Error=PackageInspectionFailed, ErrorDescription=Failed to load
Info.plist from bundle at path
/Users/{UserName}/Library/Developer/CoreSimulator/Devices/99FEB34E-6F00-4EFA-861A-A6985AFE96D8/data/Library/Caches/com.apple.mobile.installd.staging/temp.X7eead/extracted/{AppName}.app/Frameworks/LiveSDK.framework}
I'm adMob user and I solved enabling "Copy only when installing" in App target -> Build Phases -> Embed Frameworks.
Have the same problem after localizing my app. Especially Info.plist. Seems I had empty CFBundleShortVersionString in InfoPlist.strings, after fixing that the simulator started to work properly.
I got this issue by adding a folder reference named "Resources".
If I give it another name, then it runs !
There are a number of things that can cause this error. The best general answer is to search the console log for CoreSimulator, as the simulator logs the underlying problem when it displays this message.
If you have installed any libraries using CocoaPods while XCode was open, all you have to do is, Close XCode and remove the library from Pod file, run the command pod install it will uninstall that library. then install library again. Please make sure that XCode is always closed while installing and uninstalling libraries.
I hade exactly the same problem and it was ShareKit.
On the simulator I had "Error Domain=LaunchServicesError Code=0".
On the iPhone6 device I had "App installation failed Could not inspect the application package."
When I removed ShareKit it worked.
I had this problem when I added an Apple Watch target to my app, and accidentally removed the InterfaceController.m file. Adding back the file in the target fixed the problem.
There are different things that can cause this. Looking in the console may well give you a clue.
In my case - the issue was an extension built before I changed the name of the product. Xcode didn't clear the old one out, then got stressed at two extensions with the same bundle id.
(Deleting the build folder fixed my particular issue).
In my case the issue came from an icon set added with some images missing. Once I replaced the icon set with another one, and uninstalled the app in the simulator; I was able to run it again.
I removed all my pod files and replaced them all, seems the problem for me was the bolts framework was old, and causing this error. I did a clean & reset content and now it's all good.
Do not add the google maps framework to the embedded lib section this solved my build break.
I had this error in developing app for Apple Watch after adding in Info.plist: "App Transport Security Settings" and "Allow Arbitry Loads" = YES. (In WatchKit App, in WatchKit Extension is good!!)
Deleting this two rows, it keeps working.
For me, the problem occurs because I added my framework (GoogleMobileAds.framework in my case) to Embedded Binaries, not Linked Frameworks and Libraries.
For your information, AdMob instructs you to use Add Files to "Your Project" menu on Xcode, but I was too lazy to obey the instruction.
I had this problem when trying to run UI tests in a project containing AWS Cognito.
Here's how I resolved it.
Select the UI test target.
Click on the Build Phases section.
Click the plus to add a Copy Files phase
In the Copy Files phase, change the destination to Frameworks (see the last image)
Hit the plus below the Copy Files phase.
Select the framework for which you're receiving an error and hit the Add button (yours will probably not be the first item in your project hierarchy).
It should end up looking like this.
Repeat steps 5 and 6 for all frameworks giving you an error.
Run your tests.
I am using PhoneGap 2.2.0 and XCode 4.5.2.
I can test my programs in the simulators, and I can put them on my devices to test them.
But I simply cannot build for distribution. It always fails with the following error:
my-projevt-path/Classes/AppDelegate.h:30:9: 'Cordova/CDVViewController.h' file not found
I've seen this problem around the web and still can't make it work, given whatever solutions have been posted.
I've changed things in Build Settings, I've reinstalled PhoneGap, I've run new lines in terminal, I've done my app over starting a new PhoneGap project from scratch, I've checked preferences in the build location in Xcode... I can't figure this out AT ALL.
Please, can anyone help? I've been working on this for days.
Thanks!
Problems in Xcode
If you have compilation problems related to missing headers, the build products should build into the same build directory. You may need to set the preference "Xcode Preferences -> Locations -> Derived Data -> Advanced…" to "Unique". This is the default setting for Xcode on a fresh new install, if you upgraded from older versions of Xcode, you might have a legacy preference in there that you need to update.
Found the answer!!!
Yes I am getting the same problem yeah and some help could be great.....
I followed all the instructions even with the ./update_cordova_subproject path as well it does not work. Also I solved the locking problem but I could not find the solution to this problem
The answer, in my case, had seemingly nothing to do with the error message that was being sent. Missing header files? That didn't seem to be the issue. Or, at least, not the direct cause of the issue.
This was an issue with my provisioning/certificates being somehow not right. I had re-created them several times, but it continued to be an issue.
I sent the job to another developer, who opened it on his machine, revoked my certificates and created new ones, and built it without changing anything else. He forwarded me the certificate, the provisioning, and an archive of the job. I opened the archive in xCode and validated it and uploaded it. And it was fine.
If you have got this problem, be certain your certificate/provisioning is set up right. I thought mine was, but apparently it wasn't? The "Apple Process" is definitely weird, and when certificates / profiles gets messed up, problems arise.
I was having the same problem and just solved it! First of the problem may very well be because of your distribution provisioning files... but when you look at the Project Navigator in xCode at the top level you have your Project and inside you have the CordovaLib.xcodeproj click on this file and you will see the iOS Deployment target. Make sure the proper IOS version is selected there. This is 1/2.
2) Then you need to duplicate the Release configuration and rename it Distribution. While the CordovaLib.xcodeproj is selected make a build and then build the actual project. This worked smoothly for me.
Add this line to your Build Settings -> Header Search Paths:
$(OBJROOT)/UninstalledProducts/$(PLATFORM_NAME)/include
Don't replace the existing line that looks similar, that is still needed to be backwards compatible with Xcode 7 and Xcode 6.4.