Sunday, 25 March 2012

Error: iPhone Distribution: No profiles currently match

Saw this error when building for distribution.

solution at stackoverflow:

http://stackoverflow.com/questions/3608851/iphone-distribution-no-profiles-currently-match

Basically
1. in organizer under library/certificates refresh to get new developer and distribution certificates
2. go to provisioning portal, under provisioning/distribution, create a new provisioning profile, download and double click.

Error: application executable is missing a required architecture armv6

Saw this error when submitting iOS app to itunes connect.

solution from stackoverflow:
http://stackoverflow.com/questions/7053466/application-executable-is-missing-a-required-architecture-armv6

Basically change architecture from "armv7" to "armv6 armv7".

Monday, 19 March 2012

Give your function a bad name and ruins it all

I do not know about other compilers, but I happen to use a compiler which does not protect system function names, that is, if you define a function read(), it overrides some system function read() and messed up all kinds of stuff. If you rename it as readxxx(), then everything works.

This sounds really stupid, but be careful when you name your functions. Adding a prefix maybe a good idea.

Tuesday, 6 March 2012

Android: things to do before publishing your app

Assuming Eclipse is used to develop Android app. After the development work is done, before publishing your app in Google Play or Amazon Android Store, there are still several things need to be done:

Add proguard.config=proguard.cfg to project.properties. Although proguard.config is automatically generated, it is not turned on by default. You need to manually add it to project.properties to enable it in your building process, otherwise your apk file contains symbols which are easier to be reverse engineered.


Disable debug in AndroidManifest.xml, then export the app. Check proguard directory is created under your project directory. mapping.txt contains mapped symbols whereas seeds.txt contains unmapped symbols. Send the apk file to your email and open it on your Android device, then you can install it on your Android device and test it. You can also put it on a private web server and download it on your Android device to install it.

Create an EULA and a dialog to show EULA to the user the first time the app is run. Unlike iPhone App Store, Google Play does not have a general EULA for Android apps, so you had better to have one by yourself to provide at least some shelter.

Android: write string to a file


FileOutputStream os = new FileOutputStream(fileName);
OutputStreamWriter osw = new OutputStreamWriter(os); 
osw.write(str);
osw.flush();
osw.close();

Do not use
DataOutputStream os = new DataOutputStream(new FileOutputStream(file));
os.writeUTF(str); // this will write a weird char at the beginning of the file

os.writeUTF writes the string with a modified UTF-8 encoding. If the file is opened by WebView as HTML, a weird char shows up at the beginning of the file.