<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Elton&#039;s Blog &#187; iPhone</title>
	<atom:link href="http://blog.prosight.me/index.php/category/mac/iphone-mac/feed" rel="self" type="application/rss+xml" />
	<link>http://blog.prosight.me</link>
	<description>移动开发，敏捷web开发，Linux服务器部署维护，web UI和UE设计，摄影</description>
	<lastBuildDate>Wed, 08 Feb 2012 00:22:48 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>阻止iOS设备锁屏</title>
		<link>http://blog.prosight.me/index.php/2011/08/800?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=%25e9%2598%25bb%25e6%25ad%25a2ios%25e8%25ae%25be%25e5%25a4%2587%25e9%2594%2581%25e5%25b1%258f</link>
		<comments>http://blog.prosight.me/index.php/2011/08/800#comments</comments>
		<pubDate>Mon, 22 Aug 2011 08:10:06 +0000</pubDate>
		<dc:creator>Elton</dc:creator>
				<category><![CDATA[iPhone]]></category>
		<category><![CDATA[iOS]]></category>

		<guid isPermaLink="false">http://blog.prosight.me/?p=800</guid>
		<description><![CDATA[默认，所有iOS设备在过了设定的休眠时间后，都会自动锁屏。 如果你的应用不希望iOS设备自动锁屏，可以使用以下方式来保持屏幕一直开着。 1 2 3 4 5 // Disable the idle timer &#91;&#91;UIApplication sharedApplication&#93; setIdleTimerDisabled: YES&#93;; &#160; // Or for those who prefer dot syntax: &#91;UIApplication sharedApplication&#93;.idleTimerDisabled = YES;]]></description>
		<wfw:commentRss>http://blog.prosight.me/index.php/2011/08/800/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>在XCode4中添加程序调试错误信息</title>
		<link>http://blog.prosight.me/index.php/2011/08/780?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=%25e5%259c%25a8xcode4%25e4%25b8%25ad%25e6%25b7%25bb%25e5%258a%25a0%25e7%25a8%258b%25e5%25ba%258f%25e8%25b0%2583%25e8%25af%2595%25e9%2594%2599%25e8%25af%25af%25e4%25bf%25a1%25e6%2581%25af</link>
		<comments>http://blog.prosight.me/index.php/2011/08/780#comments</comments>
		<pubDate>Sat, 06 Aug 2011 23:12:37 +0000</pubDate>
		<dc:creator>Elton</dc:creator>
				<category><![CDATA[iPhone]]></category>
		<category><![CDATA[xcode]]></category>

		<guid isPermaLink="false">http://blog.prosight.me/?p=780</guid>
		<description><![CDATA[当调试程序时，程序突然崩溃，默认条件下，XCode反馈的信息不够多。可以通过以下方式让XCode反馈足够多的信息。 在Edit&#8211;>Scheme里面 找到Arguments 把下面3个值设置成YES 1 2 3 NSAutoreleaseFreedObjectCheckEnabled NSZombieEnabled NSDebugEnabled 这种方法非常好用，建议在建立一个工程的时候，加入此设置。]]></description>
		<wfw:commentRss>http://blog.prosight.me/index.php/2011/08/780/feed</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>整合cocos2d API文档到XCode中</title>
		<link>http://blog.prosight.me/index.php/2010/12/672?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=%25e6%2595%25b4%25e5%2590%2588cocos2d-api%25e6%2596%2587%25e6%25a1%25a3%25e5%2588%25b0xcode%25e4%25b8%25ad</link>
		<comments>http://blog.prosight.me/index.php/2010/12/672#comments</comments>
		<pubDate>Sun, 12 Dec 2010 06:44:54 +0000</pubDate>
		<dc:creator>Elton</dc:creator>
				<category><![CDATA[iPhone]]></category>
		<category><![CDATA[Mac]]></category>
		<category><![CDATA[api]]></category>
		<category><![CDATA[cocos2d]]></category>
		<category><![CDATA[xcode]]></category>

		<guid isPermaLink="false">http://blog.prosight.me/?p=672</guid>
		<description><![CDATA[cocos2d是经常使用的iOS游戏引擎，在编写代码的时候，经常需要参考它的API文档，本文主要介绍如何将cocos2d的文档整合到XCode中。 安装doxygen 从这里下载 http://www.stack.nl/~dimitri/doxygen/download.html#latestsrc DMG安装包。 然后点击安装即可。 安装Graphviz 从这里下载http://www.ryandesign.com/graphviz/ 然后点击安装。安装文件会安装到/usr/local/graphviz-x.y/bin目录中。 设置doxygen 修改doxygen.config文件，将HAVE_DOT设置成YES，将DOT_PATH设置成/usr/local/graphviz-x.y/bin 选择cocos2d-documentation target 打开 cocos2d-iphone的xcode项目工程 选择 “cocos2d-documentation” target XCode -> Project -> Set Active Target -> cocos2d-documentation 生成项目 像生成其他项目一样生成此项目 XCode -> Build -> Build 之后就可以在文档中查看cocos2d文档了。]]></description>
		<wfw:commentRss>http://blog.prosight.me/index.php/2010/12/672/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>给iPhone添加splash页面又一法</title>
		<link>http://blog.prosight.me/index.php/2010/10/667?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=%25e7%25bb%2599iphone%25e6%25b7%25bb%25e5%258a%25a0splash%25e9%25a1%25b5%25e9%259d%25a2%25e5%258f%2588%25e4%25b8%2580%25e6%25b3%2595</link>
		<comments>http://blog.prosight.me/index.php/2010/10/667#comments</comments>
		<pubDate>Mon, 25 Oct 2010 03:40:21 +0000</pubDate>
		<dc:creator>Elton</dc:creator>
				<category><![CDATA[iPhone]]></category>
		<category><![CDATA[iOS]]></category>
		<category><![CDATA[splash]]></category>

		<guid isPermaLink="false">http://blog.prosight.me/?p=667</guid>
		<description><![CDATA[之前有发过一篇文章，介绍了如何添加splash页面。 现在发现有一个更简单的方法。 1. 将你需要的splash界面的图片，存成Default.png 2. 在XXXAppDelegate.m程序中，插入如下代码： 1 2 3 4 5 6 7 8 9 10 11 12 - &#40;BOOL&#41;application:&#40;UIApplication *&#41;application didFinishLaunchingWithOptions:&#40;NSDictionary *&#41;launchOptions &#123; //--insert a delay of 5 seconds before the splash screen disappears-- &#91;NSThread sleepForTimeInterval:5.0&#93;; // Override point for customization after application launch. // Add the view controller’s view to the window and [...]]]></description>
		<wfw:commentRss>http://blog.prosight.me/index.php/2010/10/667/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>iPhone/Mac Objective-C内存管理教程和原理剖析(四)系统自动创建新的autorelease pool</title>
		<link>http://blog.prosight.me/index.php/2010/07/633?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=iphonemac-objective-c%25e5%2586%2585%25e5%25ad%2598%25e7%25ae%25a1%25e7%2590%2586%25e6%2595%2599%25e7%25a8%258b%25e5%2592%258c%25e5%258e%259f%25e7%2590%2586%25e5%2589%2596%25e6%259e%2590%25e5%259b%259b%25e7%25b3%25bb%25e7%25bb%259f%25e8%2587%25aa%25e5%258a%25a8%25e5%2588%259b%25e5%25bb%25ba%25e6%2596%25b0</link>
		<comments>http://blog.prosight.me/index.php/2010/07/633#comments</comments>
		<pubDate>Thu, 29 Jul 2010 06:37:43 +0000</pubDate>
		<dc:creator>Elton</dc:creator>
				<category><![CDATA[iPhone]]></category>
		<category><![CDATA[Mac]]></category>
		<category><![CDATA[objective-c]]></category>
		<category><![CDATA[内存管理]]></category>

		<guid isPermaLink="false">http://blog.prosight.me/?p=633</guid>
		<description><![CDATA[四 系统自动创建新的autorelease pool 在生成新的Run Loop的时候，系统会自动创建新的autorelease pool（非常感谢网友hhyytt和neogui的提醒）。注意，此处不同于xcode在新建项目时自动生成的代码中加入的autorelease pool，xcode生成的代码可以被删除，但系统自动创建的新的autorelease pool是无法删除的（对于无Garbage Collection的环境来说）。Objective-C没有给出实现代码，官方文档也没有说明，但我们可以通过小程序来证明。 在这个小程序中，我们先生成了一个autorelease pool，然后生成一个autorelease的ClassA的实例，再在一个新的run loop中生成一个autorelease的ClassB的对象（注意，我们并没有手动在新run loop中生成autorelease pool）。精简的示例代码如下，详细代码请见附件中的memman-run-loop-with-pool.m。 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 int main&#40;int argc, char**argv&#41; &#123; NSLog&#40;@&#34;create an autorelasePooln&#34;&#41;; NSAutoreleasePool *pool = &#91;&#91;NSAutoreleasePool alloc&#93; init&#93;; &#160; NSLog&#40;@&#34;create [...]]]></description>
		<wfw:commentRss>http://blog.prosight.me/index.php/2010/07/633/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>iPhone/Mac Objective-C内存管理教程和原理剖析(三)@property (retain)和@synthesize的默认实现</title>
		<link>http://blog.prosight.me/index.php/2010/07/630?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=iphonemac-objective-c%25e5%2586%2585%25e5%25ad%2598%25e7%25ae%25a1%25e7%2590%2586%25e6%2595%2599%25e7%25a8%258b%25e5%2592%258c%25e5%258e%259f%25e7%2590%2586%25e5%2589%2596%25e6%259e%2590%25e4%25b8%2589property-retain%25e5%2592%258csynthesize%25e7%259a%2584%25e9%25bb%2598%25e8%25ae%25a4</link>
		<comments>http://blog.prosight.me/index.php/2010/07/630#comments</comments>
		<pubDate>Thu, 29 Jul 2010 06:29:50 +0000</pubDate>
		<dc:creator>Elton</dc:creator>
				<category><![CDATA[iPhone]]></category>
		<category><![CDATA[Mac]]></category>
		<category><![CDATA[objective-c]]></category>
		<category><![CDATA[内存管理]]></category>

		<guid isPermaLink="false">http://blog.prosight.me/?p=630</guid>
		<description><![CDATA[三 @property (retain)和@synthesize的默认实现 在这里解释一下@property (retain) ClassB* objB;和@synthesize objB;背后到底发生了什么(retain property的默认实现)。property实际上是getter和setter，针对有retain参数的property，背后的实现如下（请参考附件中的memman-getter-setter.m，你会发现，结果和memman-property.m一样）： 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 @interface ClassA : NSObject &#123; ClassB *objB; &#125; &#160; -&#40;ClassB *&#41; getObjB; -&#40;void&#41; setObjB:&#40;ClassB *&#41; value; @end &#160; @implementation ClassA -&#40;ClassB*&#41; getObjB &#123; [...]]]></description>
		<wfw:commentRss>http://blog.prosight.me/index.php/2010/07/630/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>iPhone/Mac Objective-C内存管理教程和原理剖析(二)口诀与范式</title>
		<link>http://blog.prosight.me/index.php/2010/07/628?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=iphonemac-objective-c%25e5%2586%2585%25e5%25ad%2598%25e7%25ae%25a1%25e7%2590%2586%25e6%2595%2599%25e7%25a8%258b%25e5%2592%258c%25e5%258e%259f%25e7%2590%2586%25e5%2589%2596%25e6%259e%2590%25e4%25ba%258c%25e5%258f%25a3%25e8%25af%2580%25e4%25b8%258e%25e8%258c%2583%25e5%25bc%258f</link>
		<comments>http://blog.prosight.me/index.php/2010/07/628#comments</comments>
		<pubDate>Thu, 29 Jul 2010 03:38:19 +0000</pubDate>
		<dc:creator>Elton</dc:creator>
				<category><![CDATA[iPhone]]></category>
		<category><![CDATA[Mac]]></category>
		<category><![CDATA[objective-c]]></category>
		<category><![CDATA[内存管理]]></category>

		<guid isPermaLink="false">http://blog.prosight.me/?p=628</guid>
		<description><![CDATA[二 口诀与范式 1 口诀。 1.1 谁创建，谁释放（类似于“谁污染，谁治理”）。如果你通过alloc、new或copy来创建一个对象，那么你必须调用release或autorelease。换句话说，不是你创建的，就不用你去释放。 例如，你在一个函数中alloc生成了一个对象，且这个对象只在这个函数中被使用，那么你必须在这个函数中调用release或autorelease。如果你在一个class的某个方法中alloc一个成员对象，且没有调用autorelease，那么你需要在这个类的dealloc方法中调用release；如果调用了autorelease，那么在dealloc方法中什么都不需要做。 1.2 除了alloc、new或copy之外的方法创建的对象都被声明了autorelease。 1.3 谁retain，谁release。只要你调用了retain，无论这个对象是如何生成的，你都要调用release。有时候你的代码中明明没有retain，可是系统会在默认实现中加入retain。不知道为什么苹果公司的文档没有强调这个非常重要的一点，请参考范式2.7和第三章。 2 范式。 范式就是模板，就是依葫芦画瓢。由于不同人有不同的理解和习惯，我总结的范式不一定适合所有人，但我能保证照着这样做不会出问题。 2.1 创建一个对象。 1 ClassA *obj1 = &#91;&#91;ClassA alloc&#93; init&#93;; 2.2 创建一个autorelease的对象。 1 ClassA *obj1 = &#91;&#91;&#91;ClassA alloc&#93; init&#93; autorelease&#93;; 2.3 Release一个对象后，立即把指针清空。（顺便说一句，release一个空指针是合法的，但不会发生任何事情） 1 2 &#91;obj1 release&#93;; obj1 = nil; 2.4 指针赋值给另一个指针。 1 2 3 4 5 ClassA *obj2 = obj1; &#91;obj2 retain&#93;; [...]]]></description>
		<wfw:commentRss>http://blog.prosight.me/index.php/2010/07/628/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>iPhone/Mac Objective-C内存管理教程和原理剖析(一)基本原理</title>
		<link>http://blog.prosight.me/index.php/2010/07/625?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=iphonemac-objective-c%25e5%2586%2585%25e5%25ad%2598%25e7%25ae%25a1%25e7%2590%2586%25e6%2595%2599%25e7%25a8%258b%25e5%2592%258c%25e5%258e%259f%25e7%2590%2586%25e5%2589%2596%25e6%259e%2590%25e4%25b8%2580%25e5%259f%25ba%25e6%259c%25ac%25e5%258e%259f%25e7%2590%2586</link>
		<comments>http://blog.prosight.me/index.php/2010/07/625#comments</comments>
		<pubDate>Thu, 29 Jul 2010 03:05:28 +0000</pubDate>
		<dc:creator>Elton</dc:creator>
				<category><![CDATA[iPhone]]></category>
		<category><![CDATA[Mac]]></category>
		<category><![CDATA[objective-c]]></category>
		<category><![CDATA[内存管理]]></category>

		<guid isPermaLink="false">http://blog.prosight.me/?p=625</guid>
		<description><![CDATA[前言 初学objectice-C的朋友都有一个困惑，总觉得对objective-C的内存管理机制琢磨不透，程序经常内存泄漏或莫名其妙的崩溃。我在这里总结了自己对objective-C内存管理机制的研究成果和经验，写了这么一个由浅入深的教程。希望对大家有所帮助，也欢迎大家一起探讨。 此文涉及的内存管理是针对于继承于NSObject的Class。 一 基本原理 Objective-C的内存管理机制与.Net/Java那种全自动的垃圾回收机制是不同的，它本质上还是C语言中的手动管理方式，只不过稍微加了一些自动方法。 1 Objective-C的对象生成于堆之上，生成之后，需要一个指针来指向它。 1 ClassA *obj1 = &#91;&#91;ClassA alloc&#93; init&#93;; 2 Objective-C的对象在使用完成之后不会自动销毁，需要执行dealloc来释放空间（销毁），否则内存泄露。 1 &#91;obj1 dealloc&#93;; 这带来了一个问题。下面代码中obj2是否需要调用dealloc？ 1 2 3 4 5 6 ClassA *obj1 = &#91;&#91;ClassA alloc&#93; init&#93;; ClassA *obj2 = obj1; &#91;obj1 hello&#93;; //输出hello &#91;obj1 dealloc&#93;; &#91;obj2 hello&#93;; //能够执行这一行和下一行吗？ &#91;obj2 dealloc&#93;; 不能，因为obj1和obj2只是指针，它们指向同一个对象，[obj1 dealloc]已经销毁这个对象了，不能再调用[obj2 hello]和[obj2 dealloc]。obj2实际上是个无效指针。 如何避免无效指针？请看下一条。 3 Objective-C采用了引用计数(ref count或者retain [...]]]></description>
		<wfw:commentRss>http://blog.prosight.me/index.php/2010/07/625/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>iPhone 3GS升级iOS4.0并越狱</title>
		<link>http://blog.prosight.me/index.php/2010/07/616?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=iphone-3gs%25e5%258d%2587%25e7%25ba%25a7ios4-0%25e5%25b9%25b6%25e8%25b6%258a%25e7%258b%25b1</link>
		<comments>http://blog.prosight.me/index.php/2010/07/616#comments</comments>
		<pubDate>Sun, 04 Jul 2010 09:39:48 +0000</pubDate>
		<dc:creator>Elton</dc:creator>
				<category><![CDATA[iPhone]]></category>
		<category><![CDATA[3GS]]></category>
		<category><![CDATA[41周]]></category>
		<category><![CDATA[bootroom]]></category>
		<category><![CDATA[iOS4]]></category>
		<category><![CDATA[Spirit]]></category>
		<category><![CDATA[越狱]]></category>

		<guid isPermaLink="false">http://blog.prosight.me/?p=616</guid>
		<description><![CDATA[手上有一部港行的iPhone 3GS，虽然是41周前的，但是因为之前用了Spirit,所以无法直接使用自制固件了。 今天发现一个Cydia上的软件，可以解决这个问题。 前提就是您必须在iPhone 3GS的（旧的bootrom）和Spirit 越狱3.1.3 *打开cydia，并添加源 &#8211; > http://repo.woowiz.net *现在搜索 &#8211; > Spirit2Pwn。 *安装Spirit2Pwn和重新启动设备。 现在，Spirits越狱的机器可以接受任何自制4.0固件了.]]></description>
		<wfw:commentRss>http://blog.prosight.me/index.php/2010/07/616/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>如何配置iAd</title>
		<link>http://blog.prosight.me/index.php/2010/06/612?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=%25e5%25a6%2582%25e4%25bd%2595%25e9%2585%258d%25e7%25bd%25aeiad</link>
		<comments>http://blog.prosight.me/index.php/2010/06/612#comments</comments>
		<pubDate>Tue, 29 Jun 2010 02:35:23 +0000</pubDate>
		<dc:creator>Elton</dc:creator>
				<category><![CDATA[iPhone]]></category>
		<category><![CDATA[iAd]]></category>
		<category><![CDATA[iOS4]]></category>

		<guid isPermaLink="false">http://blog.prosight.me/?p=612</guid>
		<description><![CDATA[1. 导入iAd.framework 2.选择要定制iAd的TabViewController.h ， 添加代码 1 2 3 4 5 6 7 8 9 10 11 12 13 14 #import &#60;UIKit/UIKit.h&#62; #import &#60;iAd/ADBannerView.h&#62; @interface TabViewController : UIViewController&#60;ADBannerViewDelegate&#62; &#123; ADBannerView *adView; UILabel *adStatus; &#125; - &#40;void&#41;bannerViewDidLoadAd:&#40;ADBannerView *&#41;banner; - &#40;BOOL&#41;bannerViewActionShouldBegin:&#40;ADBannerView *&#41;banner willLeaveApplication:&#40;BOOL&#41;willLeave; - &#40;void&#41;bannerViewActionDidFinish:&#40;ADBannerView *&#41;banner; - &#40;void&#41;bannerView:&#40;ADBannerView *&#41; didFailToReceiveAdWithError:&#40;NSError *&#41;error; - &#40;void&#41;adAvailabilityDidChange; @property &#40;nonatomic, retain&#41; ADBannerView *adView; [...]]]></description>
		<wfw:commentRss>http://blog.prosight.me/index.php/2010/06/612/feed</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
	</channel>
</rss>

