2009年3月28日 星期六

install app on iphone

0. install .p12 file first

1. go to iphone developer program portal

2. create an app id for new app

3. enter device name & device id(can get from xcode's organizer window) for iphone

4. get an certificate

5. enter profile name

6. download profile

7. drag downloaded profile to xcode's organizer window

8. download certificate file(only first time needed)

9. double click on certificate file to install certificate (only first time needed)

10. In xcode, select device iphone, set code signing identity for build setting
set build identifier for as app ID from info.plist
build and go will install app on iphone


log message for iphone simulator

show in console.app

2009年3月27日 星期五

add photo in iphone simulator

run safari, go to a page with photo, click on photo for 5 seconds, save the photo

2009年3月26日 星期四

iphone error message

[Session started at 2009-03-27 00:21:00 +0800.]

Loading program into debugger…

GNU gdb 6.3.50-20050815 (Apple version gdb-962) (Sat Jul 26 08:14:40 UTC 2008)

Copyright 2004 Free Software Foundation, Inc.

GDB is free software, covered by the GNU General Public License, and you are

welcome to change it and/or distribute copies of it under certain conditions.

Type "show copying" to see the conditions.

There is absolutely no warranty for GDB. Type "show warranty" for details.

This GDB was configured as "i386-apple-darwin".warning: Unable to read symbols for "/System/Library/Frameworks/UIKit.framework/UIKit" (file not found).

warning: Unable to read symbols from "UIKit" (not yet mapped into memory).

warning: Unable to read symbols for "/System/Library/Frameworks/CoreGraphics.framework/CoreGraphics" (file not found).

warning: Unable to read symbols from "CoreGraphics" (not yet mapped into memory).

Program loaded.

sharedlibrary apply-load-rules all


answer: this is usually memory problem, remember to retain & release


use picker


In view controller:
(1) conform protocol: UIPickerViewDelegate, UIPickerViewDataSource
(2) add an outlet for UIPickerView
(3) implement two picker data source method
numberOfComponentInPickerView &
pickerView: numberOfRowsInComponent

In IB:
(1) add picker view to view
(2) connect file's owner's outlet pickerView to pickerView
(3) connect pickerView's outlet dataSource & delegate to file's owner

file's owner

for an xib, there is a file's owner
we can set file's owner's class
this class is the view controller for xib

ex:
create a new xib
create a view controller class A for this xib
In IB
(1) set file's owner as A class
(2) connect file's owner's outlet view to the view icon

2009年3月24日 星期二

tab bar app

1. add a tab ?
in MainWindow.xib, select Tab Bar Controller, use "+" to add tab

2. add a view for tab
(1) create ThirdView.xib
(a) create a view
In IB, file-> new-->cocoa touch template --> view
(b)set simulated metrics for view
ex: status bar , top bar, bottom bar
(c) set file's owner as UIViewController
(d) connect outlet view of file's owner to view window
(e) set nib for tab in IB

3. add a view controller for view
(1) create ThirdViewController.m & .h in xCode
(2) In ThirdView.xib, set file's owner's class identity as ThirdViewController
connect from file's owner's outlet view to view
(3) In MainWindow.xib, set tab
(a)NIB name
(b)class identity: view controller's class
(c)title
(d)image

2009年3月22日 星期日

create multiview app

1. project: window-based app

2. create view controller:
(1)root controller: manage which view to present
(2)content view controller A
(3)content view controller B

3. create nib file
view xib for content view controller

4. create outlet for root controller in app delegate
add root controller's view in applicationDidFinishLaunching
[window addSubview: myRootViewController.view];

5. in root controller's class
(1)add members for content view contrllers
(2)add IBAction to switch content view

6. in IB, create root controller from View Controller
add view to root view controller
add toolbar to view
set the action of button of toolbar as root controller's switch view method

7. in IB, connect app deletgate's outlet to root controller

8. viewDidLoad: the method called when nib is loaded

note: for different iPhone, maybe need to install new profile again



2009年3月21日 星期六

remove app in iphone simulator

delete Library/Application Support/Iphone Simulator from home directory

2009年3月20日 星期五

delegate in iphone

take responsibility for doing something on behalf of another object

ex:
myViewController implements some method of UIWebViewDelegate
it has a member with type UIWebView
then link UIWebView's delegate with myViewController(file's owner) in IB to trigger UIWebViewDelegate method called when something happens

file's owner in interface builder

for view-base app, view controller is file's owner

reason:
MainWindows.xib contain an icon represents myViewController
myViewContrller is created when app launches
when myViewController is created, it will find & load myViewController.xib.
Hence, myViewController is nib file's owner

2009年3月8日 星期日

international call software

冠碼,國碼介紹

動輒13碼以上的國際電話數字及撥號順序常令人錯亂,其實只要記住「冠碼、國碼、區碼、號碼」的順序,便能準確無誤的撥通。
直撥國際電話須先撥所在地「國際冠碼」,再撥受話方「國碼」、「區域號碼」及「電話號碼」,區域號碼前之0不須撥。舉例如下:
1.從國外撥回台灣:該國國際冠碼(詳如下表)+台灣國碼 (886)+區域號碼(去0)+用戶電話號碼。
★如從中國撥回台北市 00+886+2+XXXX-XXXX
★撥台灣行動電話時 00+886+937-XXX-XXX
註:若以手機撥打台灣的電話,只要在國碼886之前以「+」替代該國國際冠碼即可。
2.從台灣撥往國外:台灣國際冠碼(002)+該國國碼+區域號碼(去0)+用戶電話號碼。
★如從台灣撥往中國北京 002+86+10+XXXX-XXXX
★撥中國北京行動電話 002+86+行動電話號碼
註:國際間的行動電話第一碼不一定為0,如是0的話也要去掉。
要注意的是,國碼不會變,但有些國家冠碼卻不只一個,如台灣除熟知的「002」外,還有「009、006」等,差別在於費率。

app:
1. smart dialler
2. calling card
3. edit before call/sms