25 August 2010

iPhone Developers, Turn That File Vault OFF!!!

I started using a new iMac at work a few months back. Since it's a new start, I liked to give the File Vault feature a try. And that was a curse that I did not become aware of until recently.


As an iPhone developer, Xcode and iPhone Simulator are the two most frequently used pieces of software of all. When they don't work as expected, I feel really frustrated. And frustrated it is when I found that iPhone application (running on iOS 4.0) doesn't quit automatically when I try to deploy and run an updated version of app from Xcode (Build & Run by hitting Command+R). But the existing running instance enters background instead of terminating as it should. As a result, the application is update on the simulator, but the running instance is out of date. That issue made developing and debugging very difficult.

It's only yesterday that I found out File Vault was the immediate cause of this. My solution was creating an new account and start over.

13 May 2010

Notes on iPhone Application Localization

To localize an iPhone application, it's not sufficient just to localize strings in code and string in xib files.

For app itself
  • Localizable.strings for strings in code (NSLocalizedString)
  • Nib files (every *.xib file)
  • InfoPlist.strings for Info.plist
  • Strings in Settings.bundle, if there is a Settings.bundle
  • Any other app specific resources that contains text visible to users (e.g. level definition file in a game, external help file etc.)
For app store
  • App descriptions
  • "What's new in this version"
  • Keywords
The above is an incomplete list because I'm afraid there are something else to be localized that I'm not aware of. However, it is a good list to start with.

Google Native Client SDK for Chromium

With Google Native Client SDK, games on the web are so possible now!!
Chrome OS is going to survive with this.

However, security is a big concern. I'm wondering whether Google will take Apple's approach on iPhone with this, making it as close as possible to keep everything trusted.

If Google just go with the ActiveX Control approach (basically no control at all), this native API is going be a time bomb.


11 April 2010

Section 3.3.1 of iPhone OS Developer Agreement

We've been there before, and intermediate layers between the platform and the developer ultimately produces [sic] sub-standard apps and hinders the progress of the platform.
- Steve Jobs on section 3.3.1 of iPhone OS Developer Agreement

The statement is sadly very true, for most time. As a developer using Objective-C ans Xcode, section 3.3.1 doesn't really change anything for me, and probably even a good news. That made the platform more homogeneous and well-staged.

However, I do feel bad for those developers that are betting their chips on Flash, MonoTouch, Unity etc. Their chance of coming to the iPhone are practically ruined. The only chance for them is to give up their platform/language and jump into the bitten apple circle.

14 January 2010

How to compile 64bit version of boost and Qt for windows

I recently start building 64bit version of an application I've been working on for windows 7 64bit.
The first stone I hit was that all the third-party librares the application references need to be recompiled under 64bit mode. It took me some time to figure that out, and I wish sharing this info may save some troubled minds.

boost
> cd boost_1_41_0
> bootstrap
> bjam toolset=msvc-9.0 variant=debug,release architecture=x86 address-model=64

Qt
> C:\Programe Files\Microsoft Visual Studio 9.0\VC\vcvars32all.bat amd64
> cd \Qt\4.6.0_amd64
> configure
> nmake

Still working on the compilation of 64 bit ffmpeg, mingw is really giving me headache.

21 February 2009

19 January 2009

Google Shutting Down Notebook Development

The news of google shutting down the development of google notebook saddened me, like it did to millions to other people. Although they say shutting down development is not the same as shutting down the service, I say it is a hint to move on and forget about it.

Bearing its humble and limited in features, I never gave up using google notebook for its ubiquitousness, hoping google would make it a even greater product some day. Now that the hope is gone, I have no choice but to look for alternatives.

There are two possible choices right now, zoho notebook and evernote. After analyzing pros and cons, I decided to switch to evernote, which provides desktop clients as well as a web interfaces. It turned out that they've built an iPhone client.

After half a day's work, all notes have been transferred to evernote. Moving on, and never look back.

13 January 2009

An alternative way of using sio2 iPhone SDK

First we must thank the author of sio2 iPhone sdk, who have done a great deal of work to make our life easier. And better yet, it's free. If you are looking for a free iPhone game sdk, please find out more details on http://www.sio2interactive.com. Anyway, if you've reached this blog post, you probably already know of this sdk.

Now, we talk about the issues. It is very powerful and all that, the big issue I have is that the way of using the SDK is pretty primitive. I need to customize based on the template project, which i don't like because it take time to renamed the stuff.
Now if I don't want to follow that approach, I basically have to include all the source files in my project and compile very thing. That is not too bad, until I had to do clean-build frequently. A clean-build (clean first and then build) takes almost a minute on my 20 inch iMac, which is very counter productive.

My solution to this is to create a Cocoa Static Library project out of the sdk source, and reference that static library in my own game project.
Here is a step-by-step guide on how to do so:
  1. Create a Cocoa Static Library project in Xcode. Xcode -> File -> New Project -> Static Library -> Cocoa Static Library, named sio2.
  2. Download sio2 sdk, extract it. In the folder SIO2_SDK_v1.3.1, locate 'src' folder.
  3. In Finder, copy that src (or move if you wish) into the project folder 'sio2'
  4. In Xcode, add the 'src' folder to the newly created project. To do so:
    1. Ctrl click on the project root, Add -> Existing Files -> Select the 'src' folder (note that this is the one in the sio2 folder)
    2. In the confirmation dialog, make sure 'copy items to destination folder' is UNCHECKED
  5. If you try to compile now, you get a few thousand errors, there are a few things you need to do in order make it compile
    1. In Xcode, delete a file named 'sio2_wrap.c' from the 'lua' group. Since I don't know whether this file is going to be useful in the future or not, just choose 'Delete References' when Xcode asks.
    2. Now, select the sio2 group, you will see a bunch of files named like 'sio2_xxxxx.h' or 'sio2_xxxxx.cc'. You need to select all of them (except README.txt) in the top-right view, hit the Get Info icon in the tool bar. In the General tab, change the file type to 'sourcecode.cpp.objcpp'.
    3. In Other Resources, open sio2_Prefix.pch. Replace '#import <Cocoa/Cocoa.h>' with '#import <Foundation/Foundation.h>'
  6. Now build. You get no error but a tiny warning. I assume that is not critical.
  7. Change the configurations, make sure you build for all the following 4 combinations. (if you are targeting 2.1, change version number from 2.0 to 2.1 accordingly).
    1. Device - 2.0 | Debug
    2. Device - 2.0 | Release
    3. Simulator - 2.0 | Debug
    4. Simulator - 2.0 | Release
  8. In Xcode, open your own game project
  9. Ctrl click on game project root, Add -> Existing Files, choose the sio2.xcodeproj we've just created. In the confirmation dialog, make sure 'copy items to destination folder' is UNCHECKED
  10. Once added, you will see a file name 'libsio2.a' under sio2.xcodeproj. Drag that file to Targets -> game_name -> Link Binary With Binaries.
    1. Remember we have built 4 version of the static library?
    2. Xcode is smart enough to know which one to link to, when you change the configuration in your own game project.
  11. Now you need to include a single header file 'sio2.h'. You can locate the header file by either add header search path to your project configuration, OR you may just place the sio2 project folder in parallel with your game folder and use a relative path like this: #import "../../sio2/src/sio2/sio2.h"
  12. You are now good to go. Enjoy the power of sio2 sdk.

If anybody have trouble following the guide, just leave comments below. I will send out copies of the static lib project files

So what do you gain from this approach?
  • Faster building time
  • Cleaner project structure
  • Reusability, use the same static library for multiple game projects is not an issue at all.
  • You don't have to build a project from the 'tempate' project, which is kinda old-school. You get to name your project properly.
  • If the sdk is updated, just replace the 'src' folder in your sio2 static libary project. And then build for the 4 configurations. You don't have to do anything to all your game projects referencing this static library (except for compatabilty check of couse).



---------- Update (15 Jan 2009) ------------
Make sue you select 'Cocoa Static Library' while creating the sio2 project. If 'Cocoa Dynamic Library' is choosen instead, you will get over 2000 compilation errors. That's because we have not link all the frameworks yet. I don't see the point of using a dynamic library yet, so stick to the static way. cheers!



---------- Update (18 Jan 2009) ------------
There are some concerns from sio2 forum about the loss of debug symbols. The answer is debug symbols are not lost.

You will still be able to step into all the sio2 functions and view the value of primitives and structure without any issue. This works for both simulator and device, as long as build config of your game project is set to Debug. Because by doing that, Xcode links the Debug sio2 static library which contains all the necessary debug symbols.

With all that said, it WILL be a bit troublesome if you need to actually modify sio2 static library itself (because you need to open up the sio2 static library project, do some modification and build for all 4 configs).

So i'd say that this way is better for game developers who are using sio2 sdk, but definitely not for sio2 developers.


---------- Update (23 Jan 2009) ------------
For developers who wish to frequently update the sio2 SDK to suit their needs. Remove the group "sio2" (the directly contains all the files start with 'sio2_') from the static lib project, and added it into your game project. Of course the file type must be changed to sourcecode.cpp.objcpp, before everything compiles.