Monday, October 10, 2011

My first experiment with HTML5 and WebGL

I started experimenting with HTML5 and WebGL about 3 weeks ago, and after discovering a wonderful 3D javascript library called Three.js I was able to create my first 3D application on the web. It's a small solar system simulation application which can be found here: esfandiarmaghsoudi.com/Apps/SolarSystem

It's still in beta stages and Mr.doob, the author of Three.js, has kindly given me some feedback which I will try to implement soon.

At a later time (hopefully sometime during this week) I will write a tutorial of some kind, or a video perhaps, about Three.js and my experience with it (in this very short time, so far).

In the meanwhile, please check out the application and if you have any feedback I would be happy to hear them.

Thursday, January 27, 2011

The dates my iPhone app changed states in iTunes Connect

This is going to be a quick post, mainly for those anxious developers who are submitting their application to iTunes Connect for the first time. You probably want to know how long you should wait until you hear back from Apple. I know I did (not to mention I was checking my email every 5 minutes!)

  1. First I went to iTunes Connect and setup the my app's information (you can do this at any point, but you need to have the screenshots and be prepared to write a description, etc. I had prepared all this before I went to setup the app. There is a guide in iTunes Connect that describes exactly what you need). Then I received an email that the status of my app has been changed to "Waiting for Upload".
  2. Then I submitted my app on January 17, 2011 at 11 pm using the Organizer in Xcode. If everything is in order it will be successfully submitted (I suggest validating your app before the actual submission by clicking on the "Validate" button on the Organizer). Then I received an email right away that the status of my app has been changed to "Waiting for Review".
  3. Then I waited five looooong days (I suppose it's a lot better than waiting a couple of weeks or whatever, which apparently how it used to be) and on January 22, 2011 (Saturday) at 11:51 am, I received an email that the status of my app has been changed to "In Review".
  4. And the next day on Sunday January 23, 2011 at 3:16 pm I received an email saying the status of my app has been changed to "Processing for App Store". And immidiately after that at 3:17 pm, I received an email saying the status of the app has been changed to "Ready for Sale".

That brings me to another point, if you're wondering whether the reviewers work on the weekends; then I guess yes they do. I suppose you don't get to work at Apple if you're a slacker.

Anyways, hope this was helpful.

Wednesday, January 19, 2011

Setting up the Entitlements.plist file in Xcode

The process of distributing your iPhone app to the testers (doing an ad hoc distribution) can be a bit confusing to say the least. I will write about generating certificates, App Ids and provisioning profiles later (I always start writing these blogs late at night, when I don't have much time and I'm not fully awake! I don't know why) however, right now I want to talk about a specific part of the distribution that nearly made me lose my mind, namely the "Entitlements" file.

In order to be able to distribute your application you need a code signing file called "Entitlements.plist" (which was not included in my project by default) so how do we add it and configure it?

1 - In your Xcode project, click on "Resources"in the Groups & Files left side pane. Then click on File -> New File
2 - Select the Code Signing section, and then select Entitlements and hit next.
3 - Name the file "Entitlements.plist" and make sure the targets you want to use for your distributions are selected and then hit Finish. You may have just one, here I have two because my ad hoc distribution is slightly different (it includes a iTunesArtwork file which is not required to be included in package for App Store, but allows your iTunes artwork to show up in your testers' iTunes. I will write about this in another post).
4 - Then select the "Entitlements.plist" file in your Resources. An important thing here is that there should be a key in the Root of your Entitlements called "get-task-allow" and its value should be false. HOWEVER, my Entitlements file didn't have that. If this is your case as well, select application-identifier and click on the + sign on the right. This will create a new key under the Roots. Type "get-task-allow" as the key and change its type to Boolean. Then make sure the check box value is not selected.

5 - Now the important part, the "application-identifier" key. If you mess this up you will get the dreadful "Entitlements are not valid" message when your tester tries to install the app in the device (and I'm assuming that you will have problems with your App Store distribution as well maybe something like "Your bundle identifier is incorrect").

The "application-identifier" should be the exact App Id that you see when you sign in the iOS Provisioning Portal in developer.apple.com. In Provisioning Portal you have to click on App IDs tab and then select the App Id you have selected for your application and add that as the "application-identifier". This includes the ten character bundle seed ID that Apple adds automatically to your bundle ID. So it would have a form similar to xxxxxxxxxx.com.your-company-name.application-name.

Now you can also create an App Id with a wildcard, and it should still work, and in your Entitlements file you should still put the ten character bundle seed ID of the App Id followed by a dot followed by your bundle identifier; however, since I didn't use wildcard in my App Id I can't really say it will work for sure.

6 - Another thing you need to do is to make sure you specify the location of the Entitlements in your project settings.

Go to Project->Edit Project Settings. Click on the "Build" tab. Make sure the configuration is set to the "Release" mode. Then scroll down to the "Code Signing" part. Enter "Entitlements.plist" in the "Code Signing Entitlements" section. Also expand "Code Signing Identity" node and change the value to the appropriate provisioning profile that you have created in the iOS Provisioning Profile.



And that should be it.

Anyways, if you have any suggestions or questions please leave a comment.

Tuesday, January 18, 2011

Starting iPhone Development

I come from a .Net background. In fact since less than a year ago I never used a Mac, not even once. At the same time I know my story is not uncommon at all. So I thought I share my experience and mention a few things that helped me big time.

1 – My actual job, like I said, is development; so I know most of the Object Oriented concepts; but I didn’t know anything about Objective C or the Cocoa framework. If you don’t have any programing background I suggest you find some good resources and learn the fundamentals first. If you’re coming from .Net or Java or C++ world, don’t freak out at the first sight of Objective C. I have to be honest, I did. The syntax looks a bit overwhelming at the first glance but then in a short period you realize that it’s actually not that hard to learn, and in fact if someone doesn’t know C++ and Objective C; I think learning Objective C syntax would be easier (though I don’t have much experience with C++). The other interesting thing is that I found certain concepts in Objective C and Cocoa to be more similar to Java than C++. For .Net developers it’s easy to understand the relationship between Objective C and Cocoa. Objective C is the actual programing language used to write the application, whereas Cocoa is a rich set of high level APIs and libraries that make writing the application easier; sort of like the relationship between C# and .Net framework (though it’s not as tightly coupled).
2 – Before I even bought my MacBook Pro I started watching some videos on YouTube. They were actually for an iPhone course (CS193P 2009) at Stanford University; and the school was generous to upload the videos for the whole course and put them on YouTube. The course is fairly old and covers only iPhone SDK 2.x, but it covers a lot of the fundamentals. If you know the fundamentals, learning version 3 and 4 would be a matter of reading the reference document on Apple’s website. I’m not going to post all the videos, but here’s the link to the first video and you can find the rest of them in there.
3 – At some point you need a Mac; you can’t write iOS or Mac applications on anything other than a Mac. The good news is that Macs are nice; so you’re not really losing anything; and after this point all the development tools are pretty much free (except a registration cost as a developer, which you don’t need to pay until the later stages) At this point I bought my MacBook Pro, downloaded and installed Xcode and the iPhone SDK which are free from developer.apple.com and started playing around with some of the examples and some of the concepts I learned from the Stanford course.
3 – Apple has a lot of resources and their documentations are truly great. What I like about Apple’s documentation is that their intended audiences are actually human beings. Sometimes I catch myself reading something simple on Microsoft’s MSDN website over and over again. Anyways, so developer.apple.com is a great source for resources. I also bought this book called “The iPhone Developer’s Cookbook, Building Applications with the iPhone 3.0 SDK” by Erica Sadun. This is a really nice book; I highly recommend it; BUT it’s not a beginner’s book. Still, even though it’s a cookbook, it’s more than a set of examples and recipes; the author takes the time to explain certain things.
If you think you need a book to cover the basics better, I hear that “Programming in Objective C 2.0” by Stephen G. Kochan is a good book; but I personally haven’t read it.

Another good source is WWDC 2010 session videos that you can get from iTunes U (in your iTunes). There are some nice tips on how to use some tools and overall iOS development process.

4 – After the initial learning curve has passed and you started to develop your real application with your new found knowledge; you need to start thinking about subscribing as an iOS developer in Apple’s website if you want to release your app to the App Store. This isn’t necessary obviously to write your application or to run it in the simulator, but it’s required if you want to test your app on your device or if you want to release it in any shape or form. It’s $99 per year. If you’re sort of tight on budget then I suggest enrolling a little bit later in the development process, but it really depends. If you’re writing an app that requires GPS signal or gyroscope or the camera (features that are only available on the device) then it’s a good idea to test your app frequently on the device. Other than that, the simulator does a very good job of mimicking the device behavior; just remember that the simulator is probably (if you have a decent Mac) faster than your device.

5 – There are certain things I really like in Xcode and there are some I like more in Visual Studio. One thing’s for sure though, Xcode’s profiling cousin, namely Instruments, is truly amazing. It’s rich in functionality and easy to use. Which brings me to my next point. Besides testing your application regularly and following Apple’s guidelines and best practices to ensure that there are no problems with the memory management and the power consumption, I would suggest you profile your application using Instruments often. Instruments is like a window to the inner workings of your application; and it allows you to profile your app in the simulator or on the device.

6 – Once you’ve tested your application and everything seems to be in order, it’s time to prepare the app for the release. I would suggest you distribute it to a number of “testers” first, and make sure it works on the iOS versions and the devices that you have specified. In order to do this you need to generate certain things in iTunes Connect, like the AppId, certificates and provisioning profiles. I will write about these in my next blog, because I think they deserve a dedicated place of their own, and can be confusing. Here’s a good guide from Apple. I will also write about Ads in my later blogs, if that’s the route you’re choosing.

That’s it for now. Best of luck and if you have some suggestions or any question please leave a comment. Thanks.

Monday, January 17, 2011

Time to Submit My first iPhone App

Finally it’s time to submit my first iPhone app to App Store. It’s called "Order The Boxes" and it's a fun little puzzle game that has educational values as well.

The whole learning experience has admittedly been fun. The distribution portion (especially the Ad Hoc distribution) was a little bumpy the first time. I will write more about this in my later posts.

You can check out the app here (be patient, it hasn't been approved yet!)