Reputation: 142
IMPORTANT EDIT: I just realized that in a previous version the app used to desplay the icon in the top corner but now doesn't in this new version. WHY IS THIS HAPPENING THE ASSET CATALOG IS THE SAME!!! I think that there must be a problem with the assets but I know its not the assets themselves.
I have an app that is throwing a Thread 1 EXC_BAD_INSTRUCTION (code = EXC_I386_INVOP,subcode=0x0), but nothing is being printed in the console at all. Here is the line of code that is being highlighted:
var examples:[String: UIImage] = ["A": #imageLiteral(resourceName: "b"), "C" : #imageLiteral(resourceName: "d"), "E": #imageLiteral(resourceName: "f"), "G": #imageLiteral(resourceName: "H"), "I": #imageLiteral(resourceName: "j")]
Here, I am simply declaring an array with strings corresponding to UIImages. These UIImages are located in my assets folder and I have double checked that they exist in the assets folder in a subfolder called "covers". Furthermore, when typing in their name, Xcode suggests their name and displays what the uiimage looks like so I know it definitely exists. I thus have no idea what the problem is.
I have done breakpoints before and after that line and am sure it occurs on that line. Furthermore, when I change the images to display UIImages that are not in the assets folder, I get that same exception on another line in the project that uses images from the assets folder (so maybe it has something to do with the asset folder).
Other notes: THERE IS NO CONSOLE OUTPUT (AND I PRINT THINGS IN OTHER PLACES SO I KNOW THAT THE CONSOLE IS WORKING) WHEN IT CRASHES, I am collaborating with someone using github and before my partners' last commit (that changed nothing with the class that is throwing the error) it worked (i have no idea why it stopped working), I am using Xcode 8 beta 6
Here are some images of what I am seeing:
And of course, nothing in the console but (lldb) and some stuff I print on start of app.
Edit: I have reinstalled Xcode 8 beta 6 and downloaded a non-github-connected version of the app and tried to run it but still got nothing. I have cleaned project multiple times. Tried to do some clever breakpoint stuff but got nothing.
Edit 2: I have dowloaded Xcode 8, tried clearing the derived data folder, tried linking the derived data folder to not the one on my desktop but the one in my local project file linked to the git which gave me hundreds of warnings, and still nothing works.
Upvotes: 3
Views: 1635
Reputation: 4765
In my case, images were in folders, but when double clicking and selecting the image, the folder wasn't included in the path. I used a random text editor to include the folder name, as I wasn't able to edit it with XCode.
Upvotes: 0
Reputation: 7814
An addition to @computerscience32's answer: If you're building an extension (e.g. an iMessage App), check that the correct Asset is being copied. I had equally named app and an iMessage app assets, and I didn't notice that the extension doesn't contain assets from the main app.
Upvotes: 2
Reputation: 142
This took me so long to fix but the problem was that the Assets folder was removed from the build phases/copy bundle resources folder.
Upvotes: 6