My App, which is created for iOS4, is crashing in iOS6 and is not installing on simulator or device.
It just shows the splash screen and crashes.
Did finish Launching is not being called.
Can anybody please Help?
Finally i got the solution of my problem mentioned above.
In my ios4 App, in FirstViewController.xib "Use AutoLayout" was checked.
I just removed the checkmark and my App start working.
Amazing!!!
I would recommend creating a new project, and either carefully looking for the changes in delegate or any deprecated code, or just moving all of your code to the new project. Also, you should run a convert to modern syntax check.
There may be issue with Application Delegate. The obvious reason - your object is not set as an application delegate.
Looking at Apple documentation there is quite a few ways to accomplish it:
Remove application delegate binding in Interface Builder (.xib file
for the window) Set 4th parameter of UIApplicationMain in main.h to
something else than nil.
Check you nib file in Interface Builder and see if the App Delegate is setup.
Or Reference to documentation Core Application Design
Hope this will you out.
Look into the release notes of xcode, ios6
It is said that when working with IOS6, Auto Layout is turned on and that crashes the app if used on older versions. Check the link, which has other things to watch out for:
https://developer.apple.com/library/mac/#releasenotes/DeveloperTools/RN-Xcode/_index.html
https://developer.apple.com/library/ios/#releasenotes/General/RN-iOSSDK-6_0/_index.html
Related
In an Xcode project, how can I write any Swift codes that crashes the Application on startup once it’s launched/run on the simulator or device?
You can follow app lifecycle events in your UIApplicationDelegate. For example application(_:didFinishLaunchingWithOptions:)) is called, when the app started and a little time before it's visible. You can put the crashing code there.
There are a few ways to crash the app. One of them is to call fatalError().
I'm testing my app in the sim with SDK 4.3, My device is iPhone 4 with OS 4.3.3, when running the app on the sim every things is working, no errors and nothing, but on the device every thing crashes with the runtime error: "Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[ setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key addButton"
I can not find the problem in any xib file. I used to have this outlet, but not any more, not in the class and not in the xib (or maybe i am missing it, but i looked of many many hours for it) and the sim is getting it that i have changed the files but the device does not...
UPDATE: *maybe this would help. I decided to test my theory and removed (deleted) the MainWindox.xib file. compiled and got the same results...On the sim every things worked (WIERD AS IS) and in the device crashes.... The first part tells me that when the Xcode does the link and build, It builds from a deferent directory then the one that the project in... It is as weird as it can get in my eyes.... Any one has a thought about that? I think that when i will fix this every thing else will work just fine....*
What can i do?
Thank you very much,
Erez
There would most probably be a viewcontroller name just above the above error. Open the xib of that viewcontroller and check all buttons in that xib, and check the outlets of each of them. I assume you have forget to remove the outlet connection from one of the buttons.
If you cannot spot out the viewcontroller that has the problem, you need to check all xib files. Also, as alexJones mentioned, please check the capitalization of outlets as the device is case sensitive where the simulator is not.
You might had an outlet "addButton" connected to a button in XIB.
Later you might have removed "addButton" from code, but forgot to remove the connection in XIB.
If you open XIB, right click the "File's owner", you can see "addButton" in red color. Click "x" button to remove it. Then build the code and run on your iphone. It must work now.
Also clean your code, remove the app from your device before running on the device.
I've found the solution, the problem was exactly what i said, The XCode went to a wrong build somewhere, I don't know where and what happen, but it didn't go to the new build.... created a new project, copied all the files and then just changed the delegate and what needed and every thing is working, I am guessing it is a BUG, a very annoying one, but still a bug with XCode 4.
Thank you all,
Erez
Before going to such extremes as copying your project ... try cleaning your target sim and device first, then building from scratch. In effect i believe that is what you achieved by creating a new project.
I had the same problem too, would build and execute in the simulator but crash on my iPhone. The solution turned out to be improper case of a nib name in interface builder. detailView instead of the actual nib name DetailView. Great advice, thanks!
Here are my issues,
When I install my application on my test device it has the behaviour I want.
However if I close it with the IPhone main button and restart with the icon, it starts back from the view where I left it, whereas I would like it to restart from my main view controller (my start view).
In the same way, I load some animations with viewDidLoad in certain views. I want them to show only the first time the view is loaded each time the application is launched. Right now animations only works the first time the application is launched after installation, then they don't screen anymore when I launch again the application.
Does anyone have a clue ?
Thank you very much for your help.
(Sorry if this topic is a bit easy for you guys :D, I'm quite new at it !)
No problem about being new! This is happening because, for devices from iOS 4.0 on up, your app will support multitasking by default. To disable this features, Add the key
UIApplicationExitsOnSuspend
to your Info.plist file, and set its value to YES. Good luck!
In addition to Sam's answer above, you can also add a key named:
Application does not run in background and set the value to YES.
Both work fine, however.
In my project I have a subclass A of a UIPickerView.
In Interface Builder I have a UIPickerView whose type I have changed to my subclass A.
In another class B, also defined in my code, instantiated in Interface Builder and linked to A via its outlet, it refers to A with an IBOutlet field A *mySubclass.
The problem is this:
When running on the simulator it works fine; A breakpoint on B’s awakeFromNib confirms that mySubclass has been loaded and is indeed of type A.
When running on the device (iOS4.1 on iPhone 4) however, the same breakpoint reveals that mySubclass is now of type UIPickerView.
Adding an awakeFromNib to subclass A confirms that when running on the simulator A’s awakeFromNib gets called but not when running on the device.
Has anyone any idea why this might be?
Thanks in advance for any help,
Teo
An update:
After a couple of days of trying everything I eventually started trying some example projects on the device (which worked) and finally created a new project with the intention of migrating the code across in case the project itself had somehow gotten broken.
Having named the new project the same as the problematic one I noticed I couldn’t run it because of an UDID mismatch.
This caused me to have a look at the apps on the device through the Xcode organizer and noticed I had two of the same app on there. Deleting those made everything work again. Sigh. Glad it's sorted but if anyone has any idea exactly what happened I'd love to hear it.
Thanks for the eyeballs and sorry for asking an impossible problem although anyone reading this might now try removing the offending app from their device sooner rather than later.
Best, Teo
I created a Settings.bundle in my app where the user can change some properties like font size. It works.
But when I leave my App, and I change my setting, I don't know how I can get notified of the change.
For the moment, I create a function call each time a view is loaded that check for app settings.
But I wonder if there is an other and proper way to do this.
You should use your app delegate's application:didFinishLaunchingWithOptions:, or an equivalent location, to check your NSUserDefaults values, or just read them in a UIViewController viewDidLoad method.
While there is no multi-tasking, this is more than adequate. On MacOS X Cocoa we use KVO and bindings to check for changes during the execution of an application; no doubt something similar will work for 4.0 if required.
I finally found the solution. Like you said Paul, for 4.0 sdk version, there is something similar and I found it in "UIApplicationDelegate protocol".
Thank you for helping me. ;)