Overridden UIPickerView instantiated on simulator but not on device - iphone

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

Related

IB z-order on simulator 6.0

Consider the above's IB objects listing. Siblings further down the list should be on top of the siblings listed further up when rendered on the screen.
Under Xcode 4.5.2, everything is ok if iphone simulator 5.1 is used. But for simulator 6.0 the map just covers everything. The same if using actual devices (phones) for testing.
Hope that somebody knowledgeable could help.
Please also add comments if you do not (or do) find such a problem on simulator 6.0. Chances are the problem is related to how my project is setup.
Update :
Have setup a new test project with iOS 6 map view myself. There seems to be no problem with z-order at all. So the problem could relate to my code. Unfortunately, quite a lot have already been written, there wouldn't be enough time to go over everything for the time being. I suspect that it has something to do with the rootViewController property. My project initially followed a older scheme in which rootViewController was not used ...
I dont know if that order is reliable at all -- in the past definitly not and I am not conviced it is today :D. (even though apple claims it :D)
see: IPhone Interface Builder: Z-Index, Z-order of a button, image, ui element, etc?
(the 3rd answer currently. 7 votes)
The problem is solved by calling Window's bringSubviewToFront method. But I believe a better and more proper solution can be found given enough time.

App Created with ios4 is crashing in ios6 and not installing

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

xcode4 with SDK 4.3 App working in sim but crashes on device, how is that possible?

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!

How to debug EXC_BAD_ACCESS on device only

I have some code that returns a struct containing 2 objects (declared as id).
When trying to use one of the objects I get an EXC_BAD_ACCESS and the app crashes. This only happens on the device (ipad) not in the simulator.
I have set NSZombieEnabled to YES, however no information is written to the console.
I don't know if it's a problem that I'm using a workspace in Xcode 4, one project for my app, and another that builds a library which is used in my app. The EXC_BAD_ACCESS is occurring in the second project, so I don't know if NSZombieEnabled will apply to the second project?
How do I solve this? Especially as I it only happens on the device (even goes as planned on the simulator), and it is in the second project?
EDIT: This is the method where the EXC_BAD_ACCESS occurs, on line 62, on sortRange.lower –
NSZombieEnabled only works on the simulator, not on the device, so it's probably hiding the problem. Run Product > Analyze (⇧⌘B) for clues. It's harder to say more without looking at the code. As Mihai says, your objects are probably over released, which is the most common cause of EXC_BAD_ACCESS.
It seems that one of your objects is autoreleased before you are trying to access it. As the iPad has less memory than the computer you are running it on it get's released faster so that's why it's not available. Try NSLog both objects just before the line you are getting the error and see wich one of them is the problem and than trace back to it's origin and retain it somehow. Also don't forget to release it after you are done using it. Some example code would be useful.

iPhone - UITableView not calling didSelectRowAtIndexPath method in 3.0 SDK

I have an iPhone app that works fine in 2.x version of the SDK. When I upgraded to 3.0, the didSelectRowAtIndexPath method is no longer called, so the action when a user highlights a row doesn't happen. This is a custom UITableViewCell that is in a separate nib from the UITableView. Both the data source and data delegate are properly wired up in Interface Builder, and if I compile it to 2.21, it works. On version 3.0, clicking on the row doesn't do anything.
This question, mentions a similar issue, but they mention another first responder that is taking the click. I don't have any first responder methods hooked up to the cell or table.
How can I have the table work properly in 2.x and 3.0? The custom cell has a few labels and an image, and I just want to be able to click on a row and show the details for that particular row.
You probably won't like this answer too much...
Some things that worked in 2.2, don't work in 3.0 (you already know this). Some APIs have changed, etc…
A few things, however, are different because they were never supposed to work in the first place (according to Apple).
I can't be sure one of these changes is your issue, but it might be. Subtleties having to do with nibs and properties were definitely affected.
My advice would be:
First, check your nib connections, Maybe you have a connection missing that 2.2 let you get away with, but 3.0 will not.
Next, build a test app with a simple table view and see if you can get it to work. If it does, you should begin adding in complexities from your code into the test app until it breaks.
Unfortunately, this may take some time. You can also post some code to see if there is anything that we can find.
I had this same problem. I spent hours on it trying just about anything you can imagine. The funny thing was it ended up not being a problem with my code.
I am using Objective Resource and after upgrading to version 1.0.1 the problem went away. Check all your third party libraries and make sure that you are using the latest to ensure you have their 3.0 changes.