Category Archives: Mobile

Exporting your developer and distribution certs and keys from PC to Mac

Migrating my iOS developer and distribution identities from PC to Mac turn out to be a little more involved than expected. I assumed I can import the .cer and .key into my keychain and be done with it, but my Mac does not seem to recognise .cer files at all. So if you’re figuring out how to get the .cer and .key pair to install on your Mac, here’s how.

Before you begin
Have your certificate, key, and Apple’s World Wide Developer Relations (WWDR) certificate ready (available here). Mine’s named ‘developer_identity.cer’, ‘developer_identity.key’ and ‘AppleWWDRCA.cer’, so remember to replace with your own naming when running the following commands.

Open terminal and cd into the directory where the files are residing, then run these commands:

[sourcecode language=”plain”]openssl x509 -inform der -in developer_identity.cer -out developer_identity.pem

openssl x509 -inform der -in AppleWWDRCA.cer -out AppleWWDRCA.pem

openssl pkcs12 -export -out cert.p12 -inkey developer_identity.key -in developer_identity.pem -certfile AppleWWDRCA.pem
[/sourcecode]

What’s the AppleWWDRCA.cer for?
It’s Apple’s World Wide Developer Relations (WWDR) certificate required to certify your builds. Think of it as Apple’s signature on a “the internet trusts this application because Apple trusts it” agreement. You had your signature from the developer_identity obtained from Apple, and now you have Apple’s signature.

AFNetworking failing with “Garbage at end” when using php’s cURL

If you don’t set CURLOPT_RETURNTRANSFER to true, cURL outputs the results of the CURL operation directly into the response, which is then sent back to AFNetworking. If the cURL operation outputs anything but valid JSON, this most likely will cause the JSON decoding to fail with:

[sourcecode language=”plain”]Error Domain=NSCocoaErrorDomain Code=3840 "The operation couldn’t be completed. (Cocoa error 3840.)" (Garbage at end.) UserInfo=0x753e5c0 {NSDebugDescription=Garbage at end.}[/sourcecode]

To turn on CURLOPT_RETURNTRANSFER, do:
[sourcecode language=”plain”]curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);[/sourcecode]

Hope this helps prevent some hair-pulling during midnight debugs.

Tips while profiling your app to solve low memory warnings and crashes

Just a quick post to share what I learnt while investigating crashes in my iPad app. The crash reports consistently showed low memory warnings before the crash so I started using instruments to profile the app. Here’s some tips that may help you out when you are stuck using the instruments tool:

Turn off Zombies. Zombies are great for debugging messages sent to de-allocated objects, but they come at a cost of memory – NSZombies are never deallocated. Turning this off immediately showed great reductions in terms of live bytes in the allocations instrument. Apple’s documentation advises zombies to be used only on the simulator while debugging and testing.

Mark your heap before and after performing actions on your app to inspect the memory changes introduced by the action. A simple evaluation to keep in mind is that if any set of actions returns the app to the same state as before the actions, the changes in heap before and after the set of actions should be close to 0. Any significant amounts detected here would signal a leak, which need not necessarily reflect in the leaks instrument profile. Many conditions, like circular references, may cause actual leaks to be ignored in the leaks instrument, but that’s the focus of another article.

The Allocations and Activity Monitor operates differently, and gives very different results. I made the mistake of assuming the ‘live bytes’ column in the allocations report to be what my app was consuming. While allocations reported that my app is using a consistant amount of memory, I was still receiving low memory warnings, so I finally decided to run activity monitor. Surprise – the low 6.3mb consumption in allocations actually translated to 180mb in activity monitor. Why is that so? Turns our when you deallocate memory in your app, or even if you are using ARC, the memory is only released at undetermined intervals when iOS feels like it. While allocations track every memory your app allocates and deallocates, the activity monitor gives a true reflection of your app’s memory footprint.

But of course, those latent released memory wouldn’t chalk up to 100 over mb’s. The real culprit turns out to be CoreGraphics, while it handles all on screen drawings and image operations behind the scenes. The real memory consumed by these operations are not reflected in allocations at all. ARC also does not track CG objects so do remember to release them properly.

Now knowing the real issue, I proceed to refactor and restructure my drawing code to improve reuse of bitmap contexts and reduce repainting areas by keeping track of dirty rectangles. Hope these tips would help give some ideas to those of you debugging your crashes at 3 in the morning. Do also share some of your own tips or experiences in the comments!

Galaxy Note 10.1 to include Photoshop Touch

The new Galaxy Note 10.1 will be released to the public on 16th August and Samsung has preloaded it with Photoshop Touch. This will be the first time that a feature of this kind has been included on a mobile device, so it marks a significant milestone in the technology world. This was made possible, after Samsung teamed up with Adobe Systems in order to load Photoshop Touch onto the new version of the Nexus. With this feature, users will be able to sync files to the Adobe Creative Cloud, as well as having access to 2GB of free storage space.

One of the advantages of the Galaxy Note 10.1 is its affordability when compared with computer systems. With its Stylus Pen, users can still use great apps, without having to spend a lot of money in order to obtain them. So while desktop computers may be useful for some things, like typing out documents and playing party poker, the new Galaxy Note 10.1 is a good choice for app lovers. Users can edit photos while they are on the move, with their fingers or the Stylus Pen, as there are many features within Photoshop Touch that make this easy.

The preloaded version of Photoshop Touch includes some great features, such as selection tools, layers, filters and adjustments. Users can edit images to create wonderful works of art, or simply to tweak the photograph and make it appear how they want it to. The unique camera fill feature uses the tablet’s camera to fill in an area on a layer, which is a very useful tool. There is also an integrated Google Image Search, with which users can look for images, as well as the ability to share images to Facebook. This new release signals the start of something great for app lovers and should go a long way to making many image editor’s lives easier.

error: Unsupported Feature: to-many relationship … option requires Mac OS X 10.7 or later

While tinkering with the relationship properties in my Core Data model, my app suddenly failed to compile with this error:

error: Unsupported Feature: to-many relationship [Entity].[attribute]
option requires Mac OS X 10.7 or later

While it says to-many relationship is not supported, I know that’s not the real problem as I have been compiling fine with the ‘to-many‘ option turned on for a few weeks. What it’s really trying to tell you is an ‘ordered‘ AND ‘to-many‘ relationship is not supported. Once I unchecked the ‘ordered‘ option the app build fine again.

Wireframing Kits

Just like you shouldn’t start building a project from scratch, you shouldn’t start crafting a wireframe out of a blank canvas as well. The place where you should start is here:

http://www.smashingmagazine.com/2010/02/05/50-free-ui-and-web-design-wireframing-kits-resources-and-source-files/

Great looking stencil kits for building everything from iPhone, browser, facebook, MacOS apps – even Blackberry. Preview the iPhone kit below

Installing BlackBerry Tablet OS SDK for Adobe AIR

Users of 64bit windows might get frustrated installing the new BlackBerry Tablet OS SDK if you are not using the 32bit Java Development Kit (JDK). When you run the .exe from BlackBerry, an error claims that “Win64 not supported. The author of the package you are installing did not include support for this platform.” The solution is trivial:

Unzip “BlackBerryTabletSDK-Air-Installer-0.9.0-Win.exe” and you should see 2 folders, “InstallerData” and “Windows”. Go into the Windows folder and find the .lax file.

Open the file in a text editor and change this line

lax.nl.current.vm=

to

lax.nl.current.vm=[your path to java.exe]

If you are not sure where is your JDK installation, check your C:/Program Files (x86)/Java folder for a folder named like jdkx.x.x_xx. Open it and look for the bin folder inside, your java.exe should be inside. For example, my path would be:

lax.nl.current.vm=C:/Program Files (x86)/Java/jdk1.6.0_22/bin/java.exe

Save the file and run the .exe in the same folder (BlackBerryTabletSDK-Air-Installer-0.9.0.201010221500.exe) to start the installation.

If you do not have your JDK yet, get it at http://www.oracle.com/technetwork/java/javase/downloads/index.html