Archive for the 'Xcode' Category

Breaking changes to canOpenURL in iOS 9

Tuesday, September 22nd, 2015

Apple has tightened the security around launching external apps. For more background on these changes please read this post by Greg Pierce. As he states:

There are two URL-related methods available to apps on iOS that are effected: canOpenURL and openURL. Up until iOS 9, apps have been able to call these methods on any arbitrary URLs. Starting on iOS 9, apps will have to declare what URL schemes they would like to be able to check for and open in the configuration files of the app as it is submitted to Apple. This is essentially a whitelist that can only be changed or added to by submitting an update to Apple.

In order for these methods to work in iOS 9 developers need to update their app's plist with code similar to the following:


Developers using Appcelerator Titanium will need to update their tiapp.xml file to fix the Ti.Platform.canOpenURL and Ti.Platform.openURL api calls in iOS 9.

A Developer Looks at iOS 6 and the iPhone 5

Thursday, September 27th, 2012

The release of the iPhone 5 and iOS 6 has generated a lot of excitement, but the many new hardware and SDK changes can leave iOS developers feeling overwhelmed. This article is a nice summary of key changes in the iOS 6 SDK that developers should be aware of.

See on

Appcelerator Titanium :: Upgrading tiapp.xml to the newer format, and define custom Info.plist values

Friday, August 3rd, 2012

If you are using Appcelerator Titanium there was an interesting entry I noted in the version 2.1.0 changelog:

Support for custom Info.plist values in tiapp.xml. Many of the existing iOS-specific tiapp.xml values are deprecated in favor of the new values

There are two items of interest here:

  1. Many existing tiapp.xml values are now deprecated.
  2. I can now set custom key/value pairs in the tiapp.xml file and they will be inserted into the projects Info.plist automatically when the project is built. I no longer need to manually maintain a custom Info.plist file in my project to set key/values that Titanium did not officially support. Yay!

The problem is that there is no example of exactly what these entries should look like in a final working tiapp.xml file. A new project created in Titanium Studio still creates the tiapp.xml file using the older / deprecated format. Even the latest KitchenSink sample project, that has just majorly reworked for the 2.1.1 release, is still using the deprecated format.

Here is an example of a now deprecated style tiapp.xml file, which most developers are still using:

<?xml version="1.0" encoding="UTF-8"?>
<ti:app xmlns:ti="">
    <publisher>not specified</publisher>
    <url>not specified</url>
    <description>not specified</description>
    <copyright>not specified</copyright>
        <orientations device="iphone">
        <orientations device="ipad">
    <android xmlns:android="">

Note the following issues here:

  • The persistent-wifi section is deprecated in 2.1
  • The prerendered-icon section is deprecated in 2.1
  • The statusbar-style section is deprecated in 2.1
  • The statusbar-hidden section is deprecated in 2.1
  • The iphone section with the orientation settings is deprecated in 2.1

So what should this look like? And how do we set custom key/value entries to be included in the Info.plist?

Here is a working tiapp.xml file using the newer format:

<?xml version="1.0" encoding="UTF-8"?>
<ti:app xmlns:ti="">
        <target device="mobileweb">false</target>
        <target device="iphone">true</target>
        <target device="ipad">true</target>
        <target device="android">true</target>
        <target device="blackberry">false</target>
    <name>Equipd Beta</name>
    <publisher>iMatt Solutions</publisher>
    <description>Mobile App for Ministry and Bible Study</description>
    <copyright>2012 iMatt Solutions</copyright>
    <android xmlns:android=""/>
        <module platform="iphone" version="0.1.22">zipfile</module>

Notice that all of the deprecated settings are now migrated to the new ios > plist > dict section, including an example of a custom key UIBackgroundModes that will be included in the generated Info.plist.

For a detailed description of all Info.plist keys, see the iOS Info.plist Key Reference on the iOS Developer Center.

You can read more about the specifics of the tiapp.xml file here.

I hope this helps developers convert their projects over to the new format – it certainly makes more sense long term to use this approach to setting custom key/value pairs in the Info.plist file that drives our projects.

Getting Xcode to put opening braces on a new line

Saturday, April 10th, 2010

By default Xcode (the Apple Developer IDE) puts opening braces at the end of the current line like so:

if ( condition ) {
     // code here...

However I have been working on projects for years with a different convention:

if ( condition )
    // code here...

Of course developers have different preferences here. One is not right and the other wrong – that is dictated by a company or by a project, or by the consensus of the developers starting a new project. Once a convention is in place then it must be adhered to for the life of the project. And of course a decent IDE will work with developers preferences.

So – how do we get Xcode to support this alternate convention? The problem being that there is no UI preference to set this.

To change this preference the quick way:

Open the Terminal App and paste the following code:

defaults write XCCodeSenseFormattingOptions -dict BlockSeparator "\n"

Then restart Xcode. Thats it.

What does this do? It places a new entry in a plist file that is located in your user Home Directory. Home > Library > Preferences >

Next time you start coding in Xcode it will autocomplete with opening braces on a new line.