2011年6月17日

iOS App開啟載入的圖片(launch image)

如何替iOS App加入一個啟動時的載入圖片?
只要把圖片存成下列檔名後,加入專案中即可:
Default.png      320*480 iPhone, iPod
Default@2x.png 640*960 iPhone, iPod Retina Display
Default.png iPad Portriat
Default-Portrait.png      768*1004 iPad Portrait
Default-Landscape.png  1004*768  iPad Landscape

在xcode 4開始更簡單,只要在project或target裡Summary->Launch Images右鍵就可以直接加了
以為很麻煩的功能,其實出乎意料的簡單,記一下

2011年6月13日

iOS 5 beta SDK touble shooting

如果有用到libz.1.2.3.dylib這個framework(例如ASIHTTP)
iOS SDK升級到5 beta會遇到下列錯誤:
ld: library not found for -lz.1.2.3
collect2: ld returned 1 exit status
Command /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/llvm-g++-4.2 failed with exit code 1
或是用了ASIHTTP:

2011年5月17日

iOS keychainWrapper trouble shooting

之前把一個project用官方提供的Keychain Services加上了自動記憶帳號密碼的功能
一直都正常運作,直到某一天一台裝置忽然跑出了不該出現的assert:
NSAssert(SecItemAdd((CFDictionaryRef)
[self dictionaryToSecItemFormat:keychainData],NULL) == noErr, @"Couldn't add the Keychain Item." );

當機,帳號密碼存不起來
想說嘗試著要把舊的刪掉加新的看看:
SecItemDelete((CFDictionaryRef)[self dictionaryToSecItemFormat:keychainData]));
結果錯誤訊息是-25300(errSecItemNotFound, The item cannot be found.)
然後試了:
SecItemAdd((CFDictionaryRef)[self dictionaryToSecItemFormat:keychainData],NULL));
得到-25299(errSecDuplicateItem, The item already exists.)
想說這下是見鬼了,查了一堆文件也沒找到解答,其他裝置好像也沒災情
解不掉就只好暫時丟著不管

2011年4月25日

UIWebView local file注意事項

不是什麼大問題,卡了關留個紀錄
1.加入檔案時,選Create folder reference for any added folders才會建立相對資料夾
否則雖然看到有個資料夾,build到機器上檔案還是全解在根目錄

2011年4月13日

message sent to deallocated instance 除錯

常常程式一長,哪邊就不小心多release了一次
這時候編譯器就只會告訴你:BAD_ACCESS,然後程式就死了
剛開始會google到去Argument加個NSZombieEnabled YES
會多吐一點東西讓你把bug除掉
今天遇到加了這個後error message變:
[CALayer release]:message sent to deallocated instance 0x4dd650
layer這麼多怎麼知道哪裡出問題阿???
google了一下才找到解法: