LoadLevel does not work on iOS devices - unityscript

I used the latest Unity 4 with UnityScript (didn’t want to upgrade to Unity 5 before releasing the game, just to avoid complications). Unfortunately, I had to upgrade to iOS 9 and to Xcode 7. The game was built in Unity then opened in Xcode, however during deployment on iPhone I started getting error:
clang: error: linker command failed with exit code 1 (use -v to see invocation)
After upgrading to Unity 5, Xcode deployment to phone works, however on the phone I’m not able to load another scene by clicking on GUI button or with timing, it just doesn’t load, however works in the Unity editor.
Is there something wrong with Application.LoadLevel (“NewScene"); or perhaps something else needs to be done or done differently?
Also, for some reason, rotation of the object stopped working in Unity5 (even in editor)
transform.Translate(Vector3.left GameManager.speed/12 Time.deltaTime, Space.World);
GetComponent.().angularVelocity = direction * 500;
Is there anything can be done to fix both issues? Or perhaps I need to downgrade to Unity 4, then how do I fix Xcode error (above)?

Make sure you scene is included in Build Settings (File -> Build Settings...)
transform.Translate(Vector3.left GameManager.speed/12 Time.deltaTime, Space.World);
GetComponent.().angularVelocity = direction * 500;
This won't even compile because of numerous syntax errors, I bet you wanted something like this:
transform.Translate(Vector3.left * GameManager.speed / 12 * Time.deltaTime, Space.World);
GetComponent<Rigidbody>().angularVelocity = direction * 500;
If this doesn't work make sure you have Rigidbody attached, disabled Rotation Freeze on desired axis and check if direction has any value (not (0,0,0))
Also note that you shouldn't use angularVelocity directly. Unity Documentation states (http://docs.unity3d.com/ScriptReference/Rigidbody-angularVelocity.html):
In most cases you should not modify it directly, as this can result in unrealistic behaviour.
You could use http://docs.unity3d.com/ScriptReference/Rigidbody.AddRelativeTorque.html instead.

I had the same problem after upgrading to Unity 5.2 & Xcode 7 for iOS 9 , but I had to revert back because of random issues on Unity3d 5.2 of UI , Events Systems in my project.
Go to through below link request for the beta build.
http://forum.unity3d.com/threads/crash-upgrading-to-4-6-8p2-on-application-loadlevel.354899/#post-2315179

Related

SwiftUI Preview Canvas Build Fails but Project Build does Not

I am working on a project to add SwiftUI to a legacy app that uses Cocoapods. When I try to run the preview canvas the build fails and the canvas cannot run.
The cause is an issue building one of the included pods in the project (we’ll call this pod ‘LibraryX’). When XCode tries to build LibraryX it encounters a segmentation fault. But when I build the project itself there is no problem building LibraryX and starting the app.
I have tried looking for SwiftUI-preview-specific build settings in the XCode project build settings and have not been able to find anything. I have double checked the build path settings (as in this answer) and also verified that I am building on the correct device (as in this answer). In general, Googling for others who are facing similar issues has not turned up anything like my issue so far.
What I am wondering then is this: Does XCode use different build settings for building the project for use in creating the preview canvas? If so is there some way to configure how the preview canvas build works?
Because LibraryX is proprietary and the SwiftUI view I’m trying to add is simply the default “hello world” view that XCode creates there is not much I can share in the way of code samples for this question.
SwiftUI has still some bugs and is not perfect yet.
The canvas is part of SwiftUI and "shares" some of these bugs.
Sometimes you find yourself in a situation, where (a.) something does not work on Canvas or (b.) does not work correct on the simulator but (c.) works on a real device perfectly.
Most likely everything will get better over time, because SwiftUI is quite new (less then a year old) and Apple is pushing it.
My "solution" for the moment in similar situations is to not rely on canvas and just test on simulator.

Swift UI Canvas not showing with macOS 10.15 and Xcode 11.1

Canvas does not appear in my 2-year old project even though I recently upgraded to macOS 10.15 (19A547) and Xcode 11.1 (15405). I have selected Editor menu/Canvas to show it. Simulator works fine, and building a new project shows Canvas working properly. Must I enable/select/configure other parts of my project?
Read before looking at image
Canvas is actually for SwiftUI, Also you can use the benefits of it by porting your UIKit elements into the SwiftUI preview. But sometimes for some un/known reason, canvas can not reload the view in time and it's not working.
For example:
When you work on a catalyst project and select mac as a target.
When you use a custom run script that cause a change on the xcworkspace during the build process (like auto build number increment script or etc.)
When you have a long task that triggers the watch dog event. (like recursion or massive loop)
Syntax error
Complex swift code
etc.
These are just a few of them that I faced and conformed. For more information about the issue, most of the time the canvas itself reports the issue and you can read about it with clicking on Diagnostics button above the canvas window:
But some times you can't even see this pan. Sometimes disable and enable the canvas works for that situation and sometimes restarting Xcode (or even mac) works, but some times not!
Hope it helps you save some time.

Can't use safe areas in Xcode 9 after upgrading minimum deployment target to iOS 9

I have just changed my app from supporting iOS 8 and up to supporting iOS 9 and up. I believe I've done this properly, since when I now build my app, I'm getting warnings for everything in the app which was deprecated in iOS 9.
I am using Xcode 9, GM seed.
The problem is that I cannot enable the "Use Safe Area Layout Guides" toggle in any of my storyboards. When I do, I get a warning "Safe Area Layout Guide before iOS 9.0". Is there some additional setting that I need to update? A clean and build did not fix the problem.
Just deselect "Use Safe Area Layout Guides" option, which should fix this.
A screenshot below may point you the right direction.
Hope this image can help
When you changed the deployment target, did it automatically change the deployment target in your storyboard? (File inspector when opening the Storyboard)
Did you update the deployment target in both the Project and in (all) your target(s)?
Project:
Target:
I didn't try quitting Xcode and restarting it before posting to SO! Sorry! The answer is, quit Xcode and try again.
Simple fix.
In file inspector for the view, look for Builds For in Interface Builder Document and in there select iOS 9 and later.

XCode 8 interface builder problems?

I have a very strange problems with Interface Builder in XCode 8 (final, not beta). First, the width and height of ALL my UIViewControllers in the project is changed, but the size of all controls (subviews) remain the same. I suppose this happened when I upgraded the project and Open in Latest Xcode (8.0) and Deployment Target (8.3) settings were set.
Also, today I get a lot of warnings and 1 error in the same designer which yesterday works fine, even in the forms that I did not change.
So it this a bug, and how to return forms to previous state, without manually change each one of them?

Xcode Changes Contraints Of Layout By Itself After Reopening The Project

I set the constraints of layout properly and also tested it on every device. But the next time I open the project, Xcode just ruined the constraints totally.
How did this happen?
May be the project has a problem and for some reason it is not saving the changes. I have indeed put this solution on my troubleshooting book about Xcode from Apress (shameless advertising... 😃). I have seen this before.
Backup your project and try this:
Quit Xcode
Using finder, right click on the .xcodeproj file of your project and select Show Package Contents.
delete everything from that except the file project.pbxproj.
open the project again fix the constraints and see if the changes are saved the next time you open Xcode.
You did not specify you Xcode version, but my own experiences with code, that is developed using Xcode 8 Beta 1 to Beta 6: The problem may be caused by bug in XCode.
The explanation, if you use Xcode 8 Beta, could be:
New Xcode offers new storyboard-display logic, that shows different difficulties still in Beta 6
After fixing both constraints and frames automatically / manually, warnings come back again after reopening project
This problem moves from Xcode Beta 2 to Beta 6 after my own researches
Let's give Apple a little more time to fix the issues and let's wait until Apple releases GM Seed. It's only beta though

Resources