I have a Swift Package with shared code.
With Xcode's SPM added to my Xcode project.
Works great in the main app.
Doesn't work in the helper app when exported. Running the helper app in Xcode itself works fine. But when running as an exported and signed app it doesn't work.
This error message was found in console:
Fatal error: unable to find bundle named MySwiftPackageName: file MySwiftPackageName/resource_bundle_accessor.swift, line 27
I double checked, the package is really added at
Build Phase -> Link Binary With Libraries
When I inspect the exported main app and helper app I found the package in the main resources folder but not in the helper app resources folder.
How can I fix this?
In the Swift Package Manager the use of Bundle changes a bit, when you compile the source or open up Xcode a autogenerated code is available to you, which is Bundle.module.
The Bundle.module code is fairly simple and should resolve the issue, it is used like this.
SwiftUI
Image("ImageName", bundle: Bundle.module)
UIKit
UIImage(named: "ImageName", in: .module, with: nil)
messagingapp[385:75539] [Firebase/Core][I-COR000012] Could not locate configuration file: 'GoogleService-Info.plist'.
2018-01-05 01:58:22.494778+0530 messagingapp[385:75539] [Firebase/Core][I-COR000005] No app has been configured yet.
2018-01-05 01:58:22.524336+0530 messagingapp[385:75434] *** Terminating app due to uncaught exception 'com.firebase.core', reason: '`[FIRApp configure];` (`FirebaseApp.configure()` in Swift) could not find a valid GoogleService-Info.plist in your project. Please download one from
Make sure that the file name is "GoogleService-Info.plist". sometime, if you download multiple times the plist file, or if you did that for other projects, the file "GoogleService-Info1.plist" "GoogleService-Info2.plist" ... are created and it create an error. Make sure that the plist file has the right name.
Reachability *r = [Reachability reachabilityWithHostName:#"www.google.com"];
This line works fine on device, but on simulator i get crash :
* Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '+[Reachability reachabilityWithHostName:]: unrecognized selector sent to class
Does anyone know why ?
I had almost the same problem, except that linker did not link Reachability after I added it via pod.
internetReachable = [Reachability reachabilityWithHostName:#"www.google.com"];
In this line compiler was giving error 'No known class method for selector reachabilityWithHostName:'.
I tried to readd reachability, tried to clean project, nothing helped. Then I just tried to rewrite this line and it compiled!
internetReachable = [Reachability reachabilityWithHostname:#"www.google.com"];
And now I understand why it worked. Because my old code was taken from another project with other version of Reachability and selector was with 'HostName' but new one is with 'Hostname'.
Before rewriting I was checking if Reachability has this method and it seemed to me that it has and I couldn't understand the problem. It turned out that I didn't notice this small change in one letter!
solved, I was upgrading Reachability, I searched the web and I found that somewhere someone had this before and just delete systemconfiguration framework and re add it, clean the project and then build again and it will work on both simulator and device perfectly
OS X 10.5.7 (genuine Mac)
Xcode 3.1.3
iPhone SDK 3.0
When I try to execute my iPhone application in simulator, I get the dreaded error message:
Failed to launch simulated application: Unknown error.
My application has two targets, but this error occurs on both of them.
When error occurs, the simulated OS hangs — it displays black screen and no longer responds on any input. Simulator application itself does not hang — all menus are active.
All other applications I've tried running (mostly Apple samples) do work fine. Purging of caches, rebooting and howling on the Moon did not helped. Rebuilding project from scratch did not helped either. I guess I have to do it again in smaller steps.
Meanwhile, are there any other things to try than these below?
Xcode | Empty Caches...
Delete directory /Library/Caches/com.apple.DeveloperTools.###
Full rebuild
Reboot
Change the product name (it did not contain any spaces anyway)
Create new project and configure it manually from scratch
A quote from the system.log:
12.08.09 0:13:59 [0x0-0xa70a7].com.apple.iphonesimulator[5368] -[MonitorController forwardEvents]: unable to send msg to ffffffff: 10000003
12.08.09 0:13:59 [0x0-0xa70a7].com.apple.iphonesimulator[5368] -[MonitorController forwardEvents]: unable to send msg to ffffffff: 10000003
12.08.09 0:14:03 com.apple.launchd[166] (com.apple.iPhoneSimulator:com.apple.dataaccess.dataaccessd) Unknown key for integer: JetsamPriority
12.08.09 0:14:03 com.apple.launchd[166] (com.apple.iPhoneSimulator:com.apple.apsd) Path monitoring failed on "/var/mobile/Library/Preferences": No such file or directory
12.08.09 0:14:03 com.apple.launchd[166] (com.apple.iPhoneSimulator:com.apple.dataaccess.dataaccessd) Path monitoring failed on "/var/mobile/Library/Preferences": No such file or directory
12.08.09 0:14:03 vot[9750] ******** AX INSPECTOR MODE ************
12.08.09 0:14:03 vot[9750] VoiceOverTouch exiting because accessibility is not enabled. To enable do this: 'defaults write com.apple.Accessibility AccessibilityEnabled true'
12.08.09 0:14:03 Xcode[9079] Error launching simulated application: Error Domain=DTiPhoneSimulatorErrorDomain Code=1 UserInfo=0x39251e0 "Unknown error."
Note that something called VoiceOverTouch is mentioned in the log. My application does not contain (to the best of my knowledge) anything related to accessibility (could be brought in by some dependency though). I've enabled accessibility on my Mac as suggested in error message, but it did not helped. I've enabled Accessibility Inspector in the iPhone simulator. VoiceOverTouch message no longer appears in logs, but the Unknown error persists.
New logs:
12.08.09 11:01:20 com.apple.launchd[166] (com.apple.iPhoneSimulator:com.apple.AXInspector[10808]) Exited: Terminated
12.08.09 11:01:28 com.apple.launchd[166] (com.apple.iPhoneSimulator:com.apple.dataaccess.dataaccessd) Unknown key for integer: JetsamPriority
12.08.09 11:01:28 com.apple.launchd[166] (com.apple.iPhoneSimulator:com.apple.apsd) Path monitoring failed on "/var/mobile/Library/Preferences": No such file or directory
12.08.09 11:01:28 com.apple.launchd[166] (com.apple.iPhoneSimulator:com.apple.dataaccess.dataaccessd) Path monitoring failed on "/var/mobile/Library/Preferences": No such file or directory
12.08.09 11:01:28 vot[10812] ******** AX INSPECTOR MODE ************
12.08.09 11:01:28 Xcode[10200] Xcode(10200,0xb0103000) malloc: free_garbage: garbage ptr = 0x2e9b930, has non-zero refcount = 1
12.08.09 11:01:28 Xcode[10200] Xcode(10200,0xb0103000) malloc: free_garbage: garbage ptr = 0x495e240, has non-zero refcount = 1
12.08.09 11:01:28 [0x0-0xbf0bf].com.apple.Xcode[10200] Xcode(10200,0xb0103000) malloc: free_garbage: garbage ptr = 0x2e9b930, has non-zero refcount = 1
12.08.09 11:01:28 [0x0-0xbf0bf].com.apple.Xcode[10200] Xcode(10200,0xb0103000) malloc: free_garbage: garbage ptr = 0x495e240, has non-zero refcount = 1
12.08.09 11:01:28 Xcode[10200] Error launching simulated application: Error Domain=DTiPhoneSimulatorErrorDomain Code=1 UserInfo=0x49b0060 "Unknown error."
12.08.09 11:01:29 Xcode[10200] Xcode(10200,0xb0103000) malloc: free_garbage: garbage ptr = 0x44e4ba0, has non-zero refcount = 1
12.08.09 11:01:29 Xcode[10200] Xcode(10200,0xb0103000) malloc: free_garbage: garbage ptr = 0x4537820, has non-zero refcount = 1
12.08.09 11:01:29 [0x0-0xbf0bf].com.apple.Xcode[10200] Xcode(10200,0xb0103000) malloc: free_garbage: garbage ptr = 0x44e4ba0, has non-zero refcount = 1
12.08.09 11:01:29 [0x0-0xbf0bf].com.apple.Xcode[10200] Xcode(10200,0xb0103000) malloc: free_garbage: garbage ptr = 0x4537820, has non-zero refcount = 1
12.08.09 11:01:29 Xcode[10200] Xcode(10200,0xb0103000) malloc: free_garbage: garbage ptr = 0x4775400, has non-zero refcount = 1
12.08.09 11:01:29 Xcode[10200] Xcode(10200,0xb0103000) malloc: free_garbage: garbage ptr = 0x478fa20, has non-zero refcount = 1
12.08.09 11:01:29 [0x0-0xbf0bf].com.apple.Xcode[10200] Xcode(10200,0xb0103000) malloc: free_garbage: garbage ptr = 0x4775400, has non-zero refcount = 1
12.08.09 11:01:29 [0x0-0xbf0bf].com.apple.Xcode[10200] Xcode(10200,0xb0103000) malloc: free_garbage: garbage ptr = 0x478fa20, has non-zero refcount = 1
Recreating project step-by-step showed that it was directory structure.
I've had directory named 'resources' with resources for my application. That directory was added to the bundle as is (via Folder References feature).
When I renamed that directory to less common name, error went away.
So, never name any custom directories in the bundle 'resources'.
Guys from Xcode (or simulator) team could improve their error reporting. I've had to spend whole day debugging this issue. :-(
I just encountered similar error after cleaning up our XCode projects and updated them to use XCode config files. It occured only to one of our iPhone application targets, not all of them.
XCode said
Error from Debugger: Failed to launch simulated application: Unknown error.
In Console, only information was following two lines:
30.9.2009 14.31.19 com.apple.launchd[99] (com.apple.iPhoneSimulator:com.apple.dataaccess.dataaccessd) Path monitoring failed on "/var/mobile/Library/Preferences": No such file or directory
30.9.2009 14.31.19 Xcode[13827] Error launching simulated application: Error Domain=DTiPhoneSimulatorErrorDomain Code=1 UserInfo=0x389db50 "Unknown error."
It turned out that I had accidentally deleted Info.list file build setting from the target and neither XCode nor iPhone simulator could emit any useful error message about that. Adding a build setting again fixed the problem.
Looks like this is your key bit (doesn't normally come up in system log):
VoiceOverTouch exiting because accessibility is not enabled. To enable do this:
'defaults write com.apple.Accessibility AccessibilityEnabled true'
Your app has some dependency on accessibility being enabled. Suggest you follow the instruction and run the bit in quotes on your system console.
I'm worried about these two lines:
12.08.09 11:01:28 com.apple.launchd[166] (com.apple.iPhoneSimulator:com.apple.apsd) Path monitoring failed on "/var/mobile/Library/Preferences": No such file or directory
12.08.09 11:01:28 com.apple.launchd[166] (com.apple.iPhoneSimulator:com.apple.dataaccess.dataaccessd) Path monitoring failed on "/var/mobile/Library/Preferences": No such file or directory
It appears to me like your Xcode (specifically, the iPhone Simulator) installation is broken somehow. I'd suggest saving all your important files and reinstalling the SDK.
I had a similar issue with a different solution: some of my .xib files had a deployment target (2.0) that was no longer installed on my machine.
The solution was to open the xibs in Interface Builder, do cmd-opt-I to get the project info for each one, and make sure the deployment and development targets were set to correct versions.
I then did cmd-shift-K to clean the project in XCode, rebuilt, deployed, and everything seems to work fine.
Nothing above helped me - I went through all the suggestions. What eventually fixed it was deleting ~/Library/Application Support/iPhone Simulator. I then compiled and ran my app in the Simulator again, it recreated the directories, and my app ran fine. None of the accessibility or missing file errors were relevant.
To add to the above, i've had to resort to just creating a new project in my latest version of the SDK (this problem only raised its ugly head when I upgraded to 3.1.3). I then had to copy all my source files and resources over and reconfigure the build settings etc. This seems to cure the problem but it was a bit of work!
I was getting this problem when I had my Info.plist file set to export to the target. You might want to check that, de-selecting that option fixed the problem for me.
After an update of the SDK I had the same problem. None of the tips worked for me. Finally I´ve noticed in the plist file there was a space character after ${EXECUTABLE_NAME} which caused the problem.
I had a similar issue. I was also unable to install the app on a device, getting a 'The application bundle does not contain a valid identifier." error message. This was due to a directory named "Contents" added as a Folder Reference. I removed the reference, renamed the directory, add it again as a Folder Reference, clean the project, rebuild and voilà, I was able to launch the simulator.
I use the Rename Project option to change my project's name and everything worked after that. I think we're all dancing around any number of methods of "fixing" whatever internal files XCode uses to track what it's doing. Pretty frustrating bug.
Another reason for such an error message: a number in the executable file name (set in the projet plist file under "Executable file" key). The solution was to remove any number there, remove the application in the simulator, quit and relaunch xcode, rebuild, and tada, it's that simple :-(
For what it's worth, after reading this thread, I decided to just delete my targets and recreate them. Problem went away.
EDIT:
After thinking I had finally found a way of working through this, I discovered I still had issues.
The only surefire way I discovered to fix this issue is to create a new project from scratch. Then when adding new targets, rather than adding a new target, duplicate the existing target.
One thing I have noticed is that if the Project and the Targets have the GCC 4.2 settings on their settings page than everything seems to work fine. If, however, those settings are missing and instead is a section called 'User-Defined' than all sorts of weird errors occur.
I have no idea whether those settings are a symptom or the source of the problem. I have also discovered no way to consistently get the settings page to switch.
One solution, that I have seen work sometimes (but, also seen not work many other times) is to switch the active target to Device while a device is plugged in. In certain cases this causes the correct settings to load. Then when you switch back to Simulator the correct settings are still there and everything seems to work fine.
I believe I have also noticed the following: My original project file had the GCC settings on the Project Settings page. One of the targets had the settings and worked, the other target didn't and didn't work. I deleted all of the targets and re-added two new targets. After this the GCC settings disappeared on the project settings page and were also absent from the settings pages of any targets that I created. Nothing I did could change that. Any of the targets I tried to install in the simulator result in the simulator showing a black screen with an error message simply saying failed to run in the simulator with an unknown error.
Attempting to run those same targets on the device failed instantly without ever even attempting to compile (even after cleaning all targets) with an error saying something about invalid file.
I'd really love to know what's going on, but after 6 hours of no progress, I gave up and simply recreated the project and the targets as described above and everything works fine.
I believe that ultimately there are a spectrum of issues at play here. Some may be resolved by clean & rebuild, deleting preferences, etc.
None of these help resolve my issue.
I discovered that I had added some 3rd party code to my app that contained 1.) XIB files for their sample app and 2.) an info.plist file both of which erroneously had been added to my target.
Removing the XIB did not resolve the issue, but removing the info.plist file did.
Check your targets carefully and ensure that the assets that are being built and bundled are in fact needed.
I had the same issue. I had a lite scheme and a full version scheme. Neither radio button was selected under Launch. I wish I had taken a screenshot when it was in this state. As soon as I clicked "Automatically" it worked just fine.
Seems like a pretty glaring issue with XCode 4.
I had the same problem. Turned out the Info.plist was "missing" and had to be explicitly declared in the project settings. For some reason using the default name wasn't enough.