Simulator and device give different results - ios

Have any of you ever ran into issues where the changes you've made are only being reflected on the simulator and not on the device?
Example, if i want to set the selected background image view for a table cell, the selection state in the simulator will show the changes but not on the device during testing.
This inconsistency is starting to worry me because when it's time to deploy to production, how do i know that the apps in the app store will work correctly?
Thanks

Have any of you ever ran into issues where the changes you've made are only being reflected on the simulator and not on the device?
Yes, this has happened to me many times.
This inconsistency is starting to worry me because when it's time to deploy to production, how do i know that the apps in the app store will work correctly?
When I first started developing for iPhone, I once had to rewrite a significant portion of code because while it worked perfectly in the Simulator, it did not work properly on the iPhone. I realized then that the Simulator is not an Emulator, that is, it does not replicate an iPhone exactly.
You need to test on an iOS device frequently to ensure that your code is working properly. That is what the App Store reviewers will be using and what your users will be using, not the Simulator.
During your daily development, you can use the Simulator and also your fastest device, like the 5th gen iPod Touch and iPhone 5. Periodically and towards the end of your development, it is good to test on older, slower, more memory limited devices, especially the oldest available that will run the iOS version that you are targeting.

The best thing you can do when this happens is to uninstall the app your're developing, (extra measure) restart the device to clean any app caches, and finally do a clean build from XCode. Things like this tend to happen to me frequently and uninstalling my app followed by a clean build seems to do the trick all the time.

Inconsistencies happen, that's why you need to test on actual devices (and why it's a simulator, not an emulator). In this case, it's most likely being caused by XCode failing to properly update the program, in particular the nibs. Delete your app from the phone and reinstall it fresh. The app store and iTunes use a different method of installation, so you shouldn't have to worry about it in the store.

Related

Using my everyday iPhone for iOS app device testing

Today i signed up to Apple's $99 a year iOS developer program. I'm currently working on certificates, Identifiers and Profiles part so i'd be able to first test my apps on real device. I have available an iPhone 4s, iPhone 5 and iPad mini. These are my family's devices. If i use my mom's iPhone 5 for example to test my apps, would there be any negative affect to the iPhone what-so-ever? Lets say i turn off the device from Xcode and want to use another device, would iPhone 5 malfunction in any way or is it completely safe to use my main everyday device for testing?
No, In no way will it affect your everyday tasks like calling, texting, etc. When you run your project with your phone being the one you want to run it on the app will show up and stop whatever you are doing at the time but it won't have any long term effect on you or your mom's phone. However to make your app go on the phone you need to register the phones you want to use in development mode. If thats done you should be all good
Good Luck and Happy Developing!
I've been testing my app on my everyday iPhone for months now. I've had no issues at all. Nothing affects my iPhone negatively in any way. Also, don't be afraid to delete your app completely from your iPhone if you need to fix something. It also won't have any negative affect on your app or on your phone. Uploading and deleting your app has the same effect on your phone like you download an app from the App Store. That doesn't have any negative affect on your phone. Your uploading your app from Xcode to your phone will not have any negative affect.

App crashes on iPhone 5S but not on iPhone 4S.

I have an iPhone app that I have developed and tested on my iPhone 4S. The app is released on the market and some users claim that the app is unusable as it crashes on start up.
I have done exactly the same things as the users have to their devices, running the same version of the app on my iPhone 4S and I cannot get it to crash.
I have been to the houses of users and plugged their phones into my computer to get the log read out and when I do, I get errors that I am not getting on my phone and my mac.
I am completely at a loss as to how I start to find the solution to a problem like this. Does anyone have even the faintest ideas?
A good start will be to integrate a crash log collecting, crash reporting SDK in your app like HockeyApp, TestFlight, Crittercism or QuincyKit.
This will send you the crash logs to you so you don't have to collect them manually. These tools can also automatically symbolicate the crash logs for you so you can find the source of the crash in your code.
You should test a release build before you ship it. Archive a release build and distribute it as an Ad-Hoc build. You can load a saved IPA file to your iDevice using iTunes or Organizer. The thing is that you can test a release build which is the same you would ship to the App Store (they are signed differently but the build configuration is the same unless you changed that).
iPhone 5S ships with 64-bit A7 processor. Your iPhone 4 is a 32-bit device. Most likely processor architecture is not the case but as Apple says: Before you distribute your app, you must test it on actual hardware. Some of the runtime changes can be detected only when the app is running on a device. I recommend you updating your set of test devices with different models. I still own an old iPhone 3GS which is great for spotting performance issues.
The general comments others have posted are correct. Add crash logging into your app with a pre-made SDK and test on an actual device. I can't add much more to those points, but I will tell a short story about a similar bug that I found in one of my apps in the hopes it helps you with your issue.
Our app was predominately iPad2 users. When the iPad4 was released, waves of our users upgraded and they started experiencing an issue that was not present on iPad2. Two network requests were fired off at the same time and the result from one of them was crashing. We eventually found out it was a concurrency bug. The result of the first request was being processed "too quickly" and the code was getting to a critical section of code that was not thread-safe with the other request handler.
While this bug was still possible on the iPad2 if the network latency fluctuated just right, it never happened that way. The iPad4 made it happen almost every time.
You can use https://github.com/CocoaLumberjack/CocoaLumberjack lib to collect crash data logs from users.
Have you considered installing a crash logger in your app? There are plenty out there (Flurry, TestFlight, Crittercism, Hockey App, etc).
Most are fairly straightforward to install - add a framework and a couple of lines of code. Once you've done this, you'll (hopefully) be able to see exactly where your app is crashing on the users' devices, without having physical access to them.

iOS Development Testing Requirements

On Apple's website they say you to test on iPad, iPhone and iPod touch.
Is it actually required to test on all three before distributing the app, or is it acceptable to just test on one of them (say, iPhone)?
is not required,or rather, they may not know where you've tested the app, but it is obviously highly recommended to test the app on all devices and all iOS supported by your app.
the simulator replaces a device well true, but sometimes it can happen to encounter errors that simply can not be seen on the simulator, but that may be encountered on a real device
To avoid unexpected problems is always better to try more devices

How do you debug an iPhone app without having an iPhone?

Okay, I made a pretty simple iPhone app, I tested it with the iOS 5 and iOS 6 simulators for both iPhone and iPad, and everything worked fine! But when I submitted it for review, they rejected it because it crashes on the iPhone 4, and iPad 3, Is there a way I can figure out how to fix this without buying an iPhone 5 and an iPad 3? They did send me the crash files, but I have no clue how to read them. Any suggested is appreciated! :)
You don't. The Simulators are not accurate enough to debug certain problems (the Simulators only run x86 code, not the actual ARM code in the more constrained environment a device presents).
So, you may need to buy, beg or borrow a suitable iOS device or two for testing.
You have to learn how to read the crash files. Try dragging them into the organizer to start with.
There are some aspects that are different on the devices, you should have at least one iOS device of some kind to test on. An iPad is a good choice as you can test both iPhone and iPad apps. Running on any one device will shake out many errors that would happen on all of them - if for example, you didn't realize the iPhone file system was case sensitive but the Mac (and therefore the simulator) filesystem is not.
Even an older iPad 2 refurb would do for such testing...
It's very difficult to debug problems on a specific device without actually having that device. I know that there are some apple stores in my area that will rent devices for a short time for that purpose. You might check around and see if you can find one to borrow or rent for a day or two.

phoneGap app for iOs: if application works in xCode device emulator

I've got a newbie question about phoneGap and creating apps for iOs.
If my phoneGap app runs in device emulator in xCode and everything is ok, can I be sure that it will work the same way on a real iOS device when I publish it in the appstore?
The XCode simulator does what the name suggest - 'simulates'. It is not identical to the actual hardware, for a number of reasons. Here are just a few of them:
Performance - your computer has much more memory and processing power available than the phone itself. Your app may run fine on the simulator, but quite slow on the device. This is why it's a good idea to run on the device itself, especially if you're doing stuff which could use up a lot of memory.
Missing features - the simulator doesn't allow certain things to be tested, like in app purchase or media/asset management. And obviously you're missing things like the camera, the accelerometers, compass, etc. You can from iOS 5 simulate certain things like the GPS, but nowhere near everything.
Visuals - the simulator runs at your monitor resolution, whereas the phone itself has a much higher DPI display. Things that look readable or fine on the simulator can on device look very different.
If you're not testing your app on an actual device before releasing it to the app store you're doing a disservice to your users - this is Apple's point of view, and one shared by most developers. It's not necessarily what you might want to here, but unfortunately the simulator really is just that - a simulator. You wouldn't want to be in a plane piloted by somebody who had only trained on a simulator. And you probably wouldn't want to use an app that had only been run on the iOS simulator.
Here's what Apple have to say about it in their own documentation:
Although you can do much of your debugging and testing of an iOS application using iOS Simulator, simulation cannot completely match the results of running your application on the target devices; you must test your application on actual devices to ensure that it runs as intended and to tune it for performance on actual hardware.

Resources