Detecting the iPhone’s Ring / Silent / Mute switch using AVAudioPlayer not working?

Well I found the answer thanks to someone from the Developer Forums, and you guys aren’t gonna like it! I’ve had a response from Apple on this. They’ve said they don’t and never have provided a method for detecting hardware mute switch and don’t intend to do so. 🙁 IMO there is definitely value in … Read more

applicationWillTerminate when is it called and when not

In short, unless you have UIApplicationExitsOnSuspend in your Info.plist set to YES, in iOS4 and above there is no guarantee that applicationWillTerminate: will ever get called. As the documentation says: For applications that support background execution, this method is generally not called when the user quits the application because the application simply moves to the … Read more

Get a list of all contacts on iOS

In my original answer, at the end of this answer, I show how to retrieve contacts in iOS versions prior to 9.0 in a manner that addresses some of the problems entailed by other answers here. But, if only supporting iOS 9 and later, one should use the Contacts framework, avoiding some of the annoying … Read more

Handling applicationDidBecomeActive – “How can a view controller respond to the app becoming Active?”

Any class in your application can become an “observer” for different notifications in the application. When you create (or load) your view controller, you’ll want to register it as an observer for the UIApplicationDidBecomeActiveNotification and specify which method that you want to call when that notification gets sent to your application. [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(someMethod:) … Read more

How to include and use new fonts in iPhone SDK?

Add the font files to your resource files Edit your Info.plist: Add a new entry with the key Fonts provided by application. For each of your files, add the file name to this array On the example below, I’ve added the font “DejaVu Sans Mono”: In your application you can the use [UIFont fontWithName:@”DejaVuSansMono-Bold” size:14.f]. … Read more