'Unity Quit Unexpectedly' when trying to build to iOS - ios

I have made a project, and it has been working fine for the past month or so, and I would regularly build it to my iPad and play my game, but just recently when I changed my materials to Legacy and imported an asset, I am not able to build to iOS any more.
I changed all the materials back and deleted the assets, but I cannot build my project to Xcode. If I call the project a certain name - CuboidT2 - it crashes, but if I use another name, it just does nothing: it does not build or anything and the build window just stays there. It does not show any errors, and I have done nothing different (anything that I did do different I changed back).
I don't know what's happening. If you want any extra information please let me know.

Related

What is the simplest way to copy project folder to new Mac with updated IOS and Xcode?

I recently acquired a newer MacBook to run the most recent iOS and Xcode versions. I copied a project folder to the new Mac and opened it with Xcode 11.4 (was 10.1 on old Mac). I get 14 errors all related to "Failed to render and update auto layout status for ..VeiwController". The simulator runs fine, but the main storyboard doesn't render the button icons properly. I can add new constraints to the buttons to show them properly but the errors don't go away. I assume I have lost some info/files related to autolayout when I copied folders. I have read about similar issues. Most talk about using Github or some other 3rd party for maintaining files. Is there any other way to get this done? It seems like updates computers/software should be simpler.
Since reporting this, I have used the same process of copying folders of all other projects and have had no problems. But one project, the largest and most complex continues to have 14 rendering errors and always the displayed err message "An internal error occurred. Editing functionality may be limited." The strange thing is going in and out of viewing Main.storyboard several times gets rid of the errors eventually. Unfortunately, the errors always come back when I open the project. And sometimes they go away, then come back randomly in the same session.
So the answer to "whats the simplest way to copy a project folder to new computer is just that - Copy the project folder! But thats the wrong question for this problem.

Xcode crashed while renaming project - whole project broken

I wanted to release an app I worked on and quickly change the project name. I usually duplicate projects before doing things like this but this time - because this procedure always worked on Xcode as I found it way more reliable than e.g. Eclipse - I didn't, which I immediately regretted.
Opened Xcode again and now I am seeing this
I guess all the linking is gone now which is why Xcode doesn't "find" the files anymore. Renaming the remaining project stem to the old name gives
couldn’t be moved to because an item with the
same name already exists
and also manual renaming of folders won't work as the .xcodeproj is gone.
The project is written in Objective-C, and all the classes are still persistent, but the effort of adding all the xib's, referencing the outlets, setting architectures, etc will become the nightmare of my life. I do have a half-way recent backup but everything I did to make the app store-ready today will be gone.
Any ideas on how to rescue my project?
EDIT: What Xcode is now showing on the welcome screen is a project called "project" (literally) and it has the usual compass icon but with a white instead of a blue background referring to the path <project folder>/<new project name>/ and below that "white" project there is a folder icon with the new name pointing to <project folder>.
I also made a snapshot before, of course it now says "Unable to read snapshots" in the "restore from snapshots" window.
Ok what I now did is renaming ALL references from the old project name to the new one. I even changed file names. I used Xcode's CMD+SHIFT+F and TextWrangler's "replace" function and thankfully I still had the .xcodeproj from yesterday's backup so from there I could copy it into the new project and rename stuff. There are still some things that don't work perfectly, for example auto layout doesn't "stretch" contents over the screen (it stays on iPhone 4s size, even on 6 plus simulator), I needed to set the scheme again and Launch Images / Icons got lost but I can look over that. The only thing I am afraid of now is that the final build might miss out a symbol or something like that so I eventually have a corrupt file in the App Store, but man it's a beta version, how much worse can it get anyway?
Thanks to everyone recommending me to even backup the broken project, I did this even before you said it but because I think it's a valuable advice I wanted to put it in my answer as well.
It's a shame that stuff like this can happen, I've been backing up my work on a daily basis and my project never got corrupted - until now.

How to get SKAction(name:) to work reliably?

I've been working through the DemoBots example and having a lot of trouble getting it to work on all devices.
https://developer.apple.com/library/prerelease/ios/samplecode/DemoBots/Introduction/Intro.html
The current problem I'm having is that on an iPad Mini the app launches but crashes when loading animations. It crashes in AnimationComponent.swift on the line that loads an action from a file:
let bodyAction: SKAction?
if let name = bodyActionName {
// crash here
bodyAction = SKAction(named: name)
}
else {
bodyAction = nil
}
Debugging the app reveals that its trying to load an SKAction called "ZappedShake" but crashing with an array out of bounds exception.
On an iPhone 5S it runs fine. My best guess is its race condition with the faster iPhone 5S is loading the file with the action serialized in it, and by the time execution reaches this point the action is available. But on the single core older iPad the file is not yet loaded and the call fails.
Both are real hardware running iOS9 13A4325c, compiled on XCode Version 7.0 beta 4 (7A165t).
Making the problem more difficult is that I can't see where the file that apparently creates the "ZappedShake" - ReferenceActions.sks - is actually loaded. Its referred to by ReferenceScene.sks but nowhere in any of the code or anywhere else in the project can I see that file being referred to.
Is there some sort of name convention magical file loading mechanism for SKActions? Why does it work on the iPhone 5S and not on the iPad?
UPDATE: Found more on this here: http://asciiwwdc.com/2015/sessions/604
Also this year we focused on referencing and instancing.
We know you spend a lot of time designing high-quality content and animations for your games and we want you to let you reuse that content anywhere where you would like to.
We're allowing you to create serialized data files for your nodes and your actions and then add them as a reference instead of just loading them into your scene.
This way, every time you make a change to the source asset that is automatically reflected in the content of your game.
How do I do this for nodes? For nodes I design part of my scene, maybe a background element, or some scenery in our editor with an Xcode and then I can just drag-and-drop those files into my main scene in Xcode and it will automatically create a reference and it is all set up for you.
If you want to do this in code you can as well, you can manually construct an SKReferenceNode, assign it a file name or even a URL and when that content is first presented in your game we'll load in that content based on the latest version of the file that's in your bundle.
We can also do the same thing for actions. With actions go check out our great new action editor and beyond creating and composing the actions in Xcode you can give all them names.
These names are the key to using them in your game. We have added a selector to SKAction called actionNamed. This works just like it does for SKTexture and textureNamed.
You pass in the name of the action you want. We're going to automatically look inside of your app bundle in all of the serialized action files, find the one with the appropriate name and then surface that to the application.
This looks great but I can't find any documentation on it, or figure out how to debug it when it goes wrong.
It's not you, it's iOS. There's a bug with action references affecting 32-bit devices (like the iPad Mini.)
This issue has been fixed in iOS 9.2 Beta 1, according to this thread on the Apple developer's forum:
https://forums.developer.apple.com/thread/17267
Try running on a more recent 64-bit device (like iPhone 6) in the simulator. Or try upgrading your iPad Mini to iOS 9.2 Beta 1. Or just wait for the next iOS release to fix the problem.
The DemoBots game seems to run reliably when compiled with Xcode Version 7.0 beta 6 (7A192o).
Using a different machine (my home laptop) with a fresh install of Xcode the problem goes away. I also note that the first time I tried there were a few minor compile fixes I had to do such as renaming CGPoint.zero to CGPoint.zeroPoint which I guess should have sounded warning bells that there was some sort of version conflict. This time with the fresh install it compiled and ran out of the box.
I still don't completely understand how the reference actions are getting picked up but at least I now have multiple working versions of Demobots so I can just duplicate the working code there.

Accidentally deleted my target, can't get program to work

I hit 'backspace' while having selected one of my launch images and then absentmindedly pressed 'okay' before reading the popup dialog. This deleted my target, which apparently cannot be reversed.
So I created a new target with the same name as the old one and had it point to my project file. But when I run my program, it just shows a blank white screen. I checked MainStoryboard.storyboard to find that it had deleted all of my storyboards. Is there any way for me to recover my old MainStoryboard? Or my old Target? I've been trying for the last 30 minutes, looking stuff up online, nothing has worked.
I have an archive of the project from RIGHT before this happened. Is it possible to restore my project from that archive? I haven't created a snapshot since a couple of weeks ago (this was probably stupid of me) so reverting to a snapshot isn't an option.
Any help you can offer me would be greatly appreciated. This is my first iOS app. Not an hour ago I find out that my initial version was rejected from the app store for being too simple. This version had 5 completely new features, I really don't want to have lost it; this entire situation is just so disheartening.

.PNG not copying to device bundle

I've been stuck with a huge problem for a few days now and it is very frustrating. Everything was working perfectly until I messed around with target settings/provisioning a few days ago. Essentially no images are being copied from the project to be included in the app bundle.
I have:
Double checked their case consistency
Made sure they are all included in copy resource bundle section of
build phases
Performed multiple cleans and manual clean outs of the derived
data folder
And the images appear fine in the simulator.
I really don't know where else to turn or what else to try. Any help in solving this would be HUGELY appreciate as I am trying to release an update for an app but am unable to do so before getting this fixed.
ALso it is worth mentioning ever since this problem started occuring it happens in all of my xcode projects.
Check the build log. It's in the "Log Navigator" tab (press command-7). The build log graphically shows the results of the build steps.
Check the path of the individual "CopyPNGFile" steps. You can also open the textual log by clicking the far right button in each build step.

Resources