Friday, November 28, 2008

one great website about iPhone programming

http://www.stanford.edu/class/cs193p/cgi-bin/index.php

From Stanford University, Wow!

Thursday, November 27, 2008

How to play sound in iPhone

You can easily play .aiff with GSEventPlaySoundAtPath

example:
GSEventPlaySoundAtPath(@"/System/Library/CoreServices/SpringBoard.app/lock.aiff");

Add one line to LDFLAGS:
LDFLAGS += -framework GraphicsServices

Other related:
GSEventPlayAlertOrSystemSoundAtPath
GSEventPlaySoundLoopAtPath
GSEventPrimeSoundAtPath
GSEventStopSoundAtPath

Saturday, November 15, 2008

iPhone open toolchain2 on Linux

1. install building tools
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install build-essential bison flex


2. download the file to your ~ on Linux
UpgradeToolChain2.tgz

The package is very large (about 200M)
download it from http://www.iphonefix.de/
Inside the ftp server goto the folder
iPhoneToolchain VMWare Image / V3
and download the file UpgradeToolChain2.tgz

3. extract it to /usr
cd /usr
sudo tar -xzvf ~/UpgradeToolChain2.tgz

4. login as superuser and build the Darwin CC tools and llvm-gcc in Linux
su
cd /usr/toolchain2
./build_20.sh


5. For example, download this WinterBoard App Source code from the developer and compile it in Linux

wget http://svn.saurik.com/repos/menes/trunk/winterboard/Application.mm

/usr/toolchain2/pre/bin/arm-apple-darwin9-g++ -g0 -O2 -Wall -Werror -o WinterBoard Application.mm \
-framework UIKit -framework Foundation -framework CoreFoundation -lobjc -framework CoreGraphics

6. make sure you set your include and lib path correctly in your Makefile

Enjoy it!


reference: http://iphonesdkdev.blogspot.com/2008/10/how-to-install-llvm-gcc-for-iphone-sdk.html

Thursday, November 13, 2008

iPhone dev env for 2.1 on iPhone

1. install Toolchain2.0 from Cydia
2. can run GoHome.app without UI now, rember first
    ldid -S YourApp
3. download the sdk.2.0 header files, and move it to /var/include
you'd better bakup the system /var/include before.
4. can compile HelloWorld.app now
5. still can't be brought up by SprintBoard, you need to
rm -f /private/var/mobile/Library/Caches/com.apple.mobile.installation.plist
before
killall SpringBoard
You can add this line to your Makefile.

OK. That's it.

reference:
1. http://www.weiphone.com/thread-171402-2-1.html
2. http://antirez.com/page/iphone-gcc-guide.html
3. http://soi.kd6.us/2008/09/27/so-i-made-my-iphone-say-hello-world/