April 3, 2009

It’s an iPhone Life

I had heard all the horror stories about how difficult it was to develop for the iPhone and how complicated the process was before I had even begun developing for the platform. Strangely enough, I never got stuck at the points that others wrote about. Still, the process did turn out to be rather convoluted … and I’m not even through the full process yet :)

But I did encounter a few pitfalls and issues that others have not mentioned before – probably because these are unique to people outside the US who develop for the iPhone. So I thought I might as well blog about some of these issues so that it might help some other poor soul who is frazzled, confused, and tearing his/her hair out 😀

The development process itself is fairly easy and now that the NDA has been lifted, there are plenty of online resources which provide you with tutorials on getting started with developing for the iPhone as well as assist you when you get stuck.

But if you plan to get your app running on anything other than the iPhone simulator, you also need to join one of the Apple iPhone developer programs. (Yes, I know that there are ways to run your app on an iPhone without doing this but let’s not get into this since I’m basically focusing on developing for the Apple app store :p) The enrollment process should be fairly straightforward for most people who have an Apple iStore for their country. However, if your country doesn’t have an Apple iStore, then you run into your first hurdle – you need to make a payment but you need to so by contacting Apple instead of having the ease of paying online.

In my case, I had to contact the nearest Apple support point – which was in Singapore. They got back to me and provided me with a payment information form which had to be filled in and then faxed to Apple billing in the US. I did so immediately but given it was a fax, got no confirmation. I was also asked to inform my support contact in Singapore that I had sent out the fax and I did that. They e-mailed back and said that they’d contact Apple billing and verify.

A week went by and I heard nothing. So I contacted support in Singapore again. They said that they’d contacted Billing again. Another week goes by and still nothing. So I contacted Singapore once more. A few days after I contacted Singapore, I got a call from my bank, wanting to verify that I had indeed made an online payment to Apple. I knew that my payment had finally been processed :) I heard back from both Singapore and the Apple Developer Program the same day and received the link to activate my Apple Developer Program account.

Now that I was a member of the Apple Developer Program, I had the ability to compile my applications and run them on my iPhone. I could also distribute the apps I created to up to 100 iPhones that I had to manually authorize by adding their unique iPhone ID to an internal list of authorized iPhones for my account. (I haven’t got to test this feature yet but I’m sure it’ll come in handy for beta-testing …)

So far so good. I was able to work out bugs and to test functionality on my application by testing it both on the simulator and on an actual iPhone. The iPhone Developer Program portal made the process quite easy up to this point because it had detailed step-by-step instructions on how to achieve anything I wanted from creating a certificate to adding devices to creating provisioning profiles. You really should check out the “How To” tab for any task in the iPhone Developer Program portal because it gives you extremely detailed instructions on how to proceed.

Now that the app was shaping up nicely, I decided that it was time to submit the app to the Apple app store. Of course, this was where things got a bit complicated again :) First, I had to go to a new site, iTunes Connect, to submit my iPhone app to the app store. And I’m afraid iTunes Connect isn’t as user-friendly or informative as the iPhone Developer Program portal :-(

Once you log into iTunes connect, you might wonder what you have to do next. The first thing to do is to click on “Manage Your Applications” to add a new app. And there, you run through several screens of information about your application. You also have to have various screenshots and icons ready at this point. Remember that most images accepted here are JPG or TIFF and that you can take a screenshot directly in your iPhone by pressing the “Home” button and then pressing the power/start button while keeping “Home” pressed and you should be fine :) (Of course, screenshots taken this way are PNG and you’ll have to convert them to JPG or TIFF …)

The biggest issue I had at this point was that I got the dreaded “Invalid binary. The signature was invalid, or it was not signed with an Apple submission certificate.” error that you get on uploading the compiled application. This appears to be fairly common since there’s a lot of information online about this if you do a search. Some people suggest checking that the app is signed properly by running “codesign -vvvv <YourAppName.app>” in a terminal window (where <YourAppName.App> will be replaced with the actual app name, of course). Others mention that this might be because your application icon is not named “Icon.png” (case-sesitive). I tried most suggestions but none seemed to work for me :-(

After several hours of mucking around, I discovered that in my case, the issue was that I had set the “Code Signing Identity” property incorrectly. You can find this property by selecting your application under “Targets” in XCode and then click the “Info” button on your toolbar and then switching over to the “Build” tab of the dialog which opens. The setting is under the “Code Signing” section. In my case, I appeared to have set the first value “Code Signing Identity” as well as the next one, “Any iPhone OS Device” and this appeared to cause issues. As soon as I cleared “Code Signing Identity” (left it blank) and then set the identity I wanted under “Any iPhone OS Device”, the binary was accepted by iTunes Connect. (And remember that you can’t upload your application as a .app file, you have to ZIP it up first.)

At this point, I was informed that I didn’t have a “Paid Applications” contract in place because I wanted to sell my application on the app store. Apparently, all the previous work in faxing stuff to Apple and paying US$ 99 had been to simply get the right to distribute free apps via the Apple App Store. If I wanted to sell my apps, I had more paperwork to do :) However, the process does let you finish submitting your application for the Apple review process before you have to go complete the new paperwork.

If you get through the application submission process, don’t think that that’s it and sit back and relax. You sill have to do the “Paid Applications” contract. This appears under the “Manage Your Contracts” section in iTunes Connect and will show that you now have two contract – one for free applications and one for paid. You’ll notice that the free application is complete while there’s information that you have to fill out for the paid one.

So go ahead and get going on that one. Most of the information is fairly straightforward except for a few things. They want your bank address and if you use HSBC as I do, HSBC only give s PO Box number for Sri Lanka. And Apple says that you cannot provide a PO Box :-( I simply put in the PO Box number since there was no other option but that might come back to haunt me.

The other issue was a US EIN. You need to obtain a US EIN or your Apple App Store income will be taxed at the standard value of 30% instead of the 10% value you’ll get as a resident of Sri Lanka (there are other places which aren’t taxed at all …). To obtain an EIN, you need to call the IRS. Yes, you need to make an international call :-(

Actually, that’s not strictly true. If you can wait, you can also mail out the EIN request form or fax it to the IRS. If you fax it, they say that they’ll get back to you within four business days. However, if you call, you get the EIN over the phone, immediately. I opted to call and was on hold for about 25 minutes. Then I messed up in asking for the right division, got transferred and had to disconnect because the person I was transferred to refused to transfer me back. So I called again and was on hold another 20 minutes or so but finally got through and got the EIN sorted out. Total time? About an hour on the phone to the US.

Once that was done, the rest of the process was fairly easy. You have to fill in the last Apple tax form giving your EIN and a few minutes later, you receive a PDF via e-mail with the filled in information. You have to print out that form, sign it and then mail it out to Apple. If they don’t have that form on file at the time they have to make your first payment to you, they’ll deduct 30% from your payment instead of the reduced 10% deduction (for Sri Lanka).

That’s where I am at the moment. I’ll now have to wait to see how soon my application goes through the Apple application review process and whether it gets accepted or rejected. Different people seem to have different experiences at this point. Some say that their app was accepted within days. Others say that they waited weeks. There’s also a lot of noise online about how Apple is backlogged and they take about a month to approve applications. I don’t know which of these is correct. Guess I’ll just have to wait and find out :)

Update: Info that I discovered just a little while ago over here (and on a few other places) seems to indicate that the whole over spent on the phone with the US IRS was totally unnecessary. The information on the forum link above seems to indicate that Apple does not withhold tax either way and that you don’t really need an EIN. Of course, I don’t know for sure. So I can’t say one way or another with certainty but hopefully the information will help somebody else :)

Be Sociable, Share!
Tags: Coding
Posted by Fahim at 11:09 am   Comments (0)