iOS UIWebView and Javascript interactions
發文作者 cotton5415 於 二月 22, 2013
發表於 iPhone's Road | 已加上的標籤: cotton5415, iOS, iPhone | 張貼留言 »
iOS PDF rendering performance improve items.
發文作者 cotton5415 於 十二月 7, 2012
發表於 iPhone's Road | 已加上的標籤: cotton5415, iPad, iPhone, pdf viewer | 張貼留言 »
Auto increment build number by run script. (Xcode)
發文作者 cotton5415 於 七月 13, 2012
1. to add key in your Project-info.plist
CFBuildNumber, CFBuildDate
2. add scripts to your run script (in Xcode)
myPlist=$PROJECT_DIR/$PROJECT_NAME/$PROJECT_NAME-info.plist
CFBuildNumber=$(/usr/libexec/PlistBuddy -c “Print CFBuildNumber" $myPlist)
CFBuildNumber=$(($CFBuildNumber + 1))
/usr/libexec/PlistBuddy -c “Set :CFBuildNumber $CFBuildNumber" $myPlist
CFBuildDate=$(date)
/usr/libexec/PlistBuddy -c “Set :CFBuildDate $CFBuildDate" $myPlist
echo “build number: " $CFBuildNumber
3. get info from Project-info.plist and show on somewhere.
NSString * version = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleVersion"];
NSString * buildNo = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBuildNumber"];
NSString * buildDate = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBuildDate"];
發表於 MAC OS X's Road | 已加上的標籤: iOS, iOS cotton5415, iOS dev, mac os x, Xcode, Xcode cotton5415 | 張貼留言 »
Can’t debug iOS 4.2 with iPodTouch 3G in Xcode 4.3
發文作者 cotton5415 於 六月 19, 2012
This is regards to debug by Xcode 4.3 and attempting to run on an earlier device (e.g. iPhone 3G, 2G, iPod 1st gen, etc)
Solution: Remove ‘Required Device Capabilities’ in XXXX-info.plist if wanting to support devices that run armv6 (e.g. the iPhone 3G).
發表於 MAC OS X's Road | 已加上的標籤: cotton5415, debug, Finish running, iPodTouch, Xcode | 張貼留言 »
instruments remote exception encountered
發文作者 cotton5415 於 六月 6, 2012
solution:
make sure your Xcode set the Profile scheme as Debug than Release.
發表於 MAC OS X's Road | 已加上的標籤: cotton5415 iOS, instrument, iOS, mac, Xcode | 張貼留言 »
Grab Screen from Mac OS X Lion(10.7)
發文作者 cotton5415 於 十二月 29, 2011
Mac OS X Lion seams disable OpenGL screen. So, glReadPixel can’t get screen shot.
The solution to grab the screen:
CGImageRef image = CGDisplayCreateImage(kCGDirectMainDisplay);
發表於 MAC OS X's Road | 已加上的標籤: 10.7 capture, 10.7 grab, cotton5415 10.7 capture, cotton5415 10.7 screen capture, cotton5415 lion, cotton5415 Lion capture, cotton5415 Mac OS X, grab, Lion capture, Lion grab, Mac OS X capture. | 張貼留言 »
iOS 5 storyboard tutorial reference.
發文作者 cotton5415 於 十一月 11, 2011
發表於 MAC OS X's Road | 已加上的標籤: cotton5415, iOS, iOS 5, storyboard | 張貼留言 »
cow, 改什麼storyboard…..xib 沒得用了。maintain 很麻煩。
發文作者 cotton5415 於 十月 17, 2011
發表於 MAC OS X's Road | 已加上的標籤: cotton5415, ib, iOS, iOS 5, storyboard, xib | 張貼留言 »
TCP 常見問題 1 : 如何知道對方不正常斷線?
發文作者 cotton5415 於 七月 13, 2011
問題: Peer A & Peer B 已經建立連線。但是Peer B突然電源線被拉掉,也沒電池撐著,或是突然B端的網路線被拉掉。這時候Peer A 的應用程式也沒有對B進行資料的收送。等到下次要搜送資料的時候,卻卡在send recv or read/write 當中。怎辦?
解法;利用 tcp keep alive.在socket 建立的時候 加上
int optval = 1 ;
setsockopt(sockfd, SOL_SOCKET, SO_KEEPALIVE, (const S8 *)&optval, sizeof(optval))
optval = 10 ; // seconds
setsockopt(sockfd, IPPROTO_TCP, TCP_KEEPALIVE, (const S8 *)&optval, sizeof(optval))
optval 設定成 timeout 的時間。這個timeout發生的時候, tcp 會送一個 SYN 給對方。
http://tldp.org/HOWTO/TCP-Keepalive-HOWTO/programming.html#setsockopt
發表於 MAC OS X's Road | 張貼留言 »