avoiding selector not found in iOS - ios

I downloaded a calendar tutorial and ran it with deployment target as iOS 6.1 and ran it in the simulator, everything went fine. I loaded it onto a iOS 6.1 device and it crashed with "selector not found"
It uses 'startOfDayForDate'
return [[NSCalendar currentCalendar] startOfDayForDate:self.start];
This crashes on the iOS 6.1 test device yet it works in the simulator even though I have a deployment target of iOS 6.1.
I used instancesRespondToSelector and found it doesn't respond.
I listed out the methods and found about 30 methods fewer when I run the same program on the device when compared to the simulator.
Note that the other settings are the same.
Q. How do you set the simulator to simulate a certain OS?
Is there some hidden setting I don't see that would cause the simulator to load methods from a different version of iOS?

Looking at the documentation here it looks like this method is only supported in iOS 8.0 and later which is why this crashes on your iOS 6.1 device.
You are probably running a simulator for a version of iOS later than 8.0.
If you're running xCode 6.0 or later the earliest simulator you can download is iOS 7. This is better described here

Related

Why does os_log(), available on iOS 10 work on iOS 9?

I have an app that needs to support iOS 9.3 and above. I was trying Unified Logging which is only available on iOS 10.0+ (specific method: os_log).
Here's how I used it:
#include <os/log.h>
os_log(OS_LOG_DEFAULT, "this is a log");
I expected it to crash on iOS 9.3. To my surprise, when I ran the app on iOS 9.3 simulator and then an iPhone, it ran fine. I tried cleaning and then rebuilding but it still worked.
Why would the os_log() still work on an iOS version it's not supposed to be on?

sqlite3 crashes in iOS 9.0 device

I had developed an application which uses the SQLite database. It was working perfectly fine until iOS 8.4 on both iOS simulators and devices but on iOS 9.0 it is crashing by giving error "database is locked" on physical device while working perfectly on iOS 9.0 simulator.
It is giving error in SQLiteManager.m
Please note that:
I am using XCode 7.0 Beta 3
My physical device has iOS 9.0 Beta 3 which is the same version of my iOS simulator
I have set the build target to 9.0 which was initially showing many warnings but I have updated all the deprecated things in the code according to iOS 9.0 like UIAlertControllerView etc.
There is no warning in code now.
I have tried by deleting and adding again both libsqlite3.0 and libsqlite framework. But the error is still there.
I have read many blogs and even on Stack Overflow related to this and found solution of writing sqlite3_close(database) and sqlite3_finalize(command) after execution of command and I have done that too, but still failed to achieve any output.
There was problem in compatibility. It has been resolved automatically since X Code 7 and iOS 9 Beta 5 is released.

New compile errors on iOS 7.1 SDK targeting iOS 7.0 deployment target

Just updated my local SDK to iOS 7.1 and Xcode to 5.1. All is fine but when I tried to compile a perfectly fine 7.0 codebase targeting the Simulator it runs fine but when I tried to target a device that runs iOS 7.1 it gave a whole set of new compile errors. There's just a lot to list out here but the more prominent one is from the famous SVPRogressHUD.
Is anything changed in iOS 7.1 SDK that need treatments differently? This is so annoying for the past hour or so.

Xcode, Simulator: App crashes on launch on older version of Simulator

I'm having some trouble supporting older versions of iOS. I first noticed this when a buddy of mine was using my app and it crashed. He's running iOS 5 and I'm running iOS 6. I'm building with base SDK 6.0 and I've tried changing the deployment target, the architectures, and pretty much everything I could find and think of. Nothing works and when building on iOS 5 simulator, the app crashes at launch.
I need to fix this so my older version users who download my app aren't experiencing crashes.
Are you using autolayout on any of your xib files? By default you would be. If you still are, switch it off.

Xcode: App builds, but "runs" and "finishes" at the same time

I have an app created from sample code I found online. I hooked up my iPod touch 4G to my computer and everything worked fine, app ran.
Then I hooked up my iPhone 3G to the computer, established provisioning profiles, etc. In the organizer the device shows up as a green dot, so we're good. The name of the device is right there next to the run button so that's a good sign. But when I hit run it says "build succeeded" and then goes directly to "finished running on " but nothing shows up on the app!
I've tried this with several apps now and all work on iPod touch, but none on iPhone.
Devices are running newest operating systems, 4.2 for the iPhone, Xcode version is the newest.
I had a different question with more than likely the same answer
App built with Xcode 4.2 ios 5.0 crashing when installed on iphone with ios 4.3.5
I found the solution here
Is it possible to target older iOS versions when using Xcode 4.2 and iOS 5 SDK?
by mmorris
I had to do what he clearly explained and 1 more thing:
Set the compiler in the Project and Target Build Set to LLVM GCC 4.2
That got the app running on my older devices
I had problem to run on simulator not on device.
Tried above options but didn't work for me.
Finally, Just Resetting Simulator did the trick.
Make sure you are targeting the least iOS version and SDK that you can in the build profiles (targets, summary, Devices, Deployment target). Also, check the error console (All Output) at the bottom right and see if there's some kind of problem occurring.

Resources