Example code for iOS and OSX Promises