<?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>iPhone SDK develop &#38; programming tips</title>
	<atom:link href="http://www.flyblog.info/feed" rel="self" type="application/rss+xml" />
	<link>http://www.flyblog.info</link>
	<description>Brilliant life with wordpress.</description>
	<lastBuildDate>Fri, 11 Dec 2009 17:18:40 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.5</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		
<!-- Start Of Script Generated By WP-PostViews Plus -->
<script type='text/javascript' src='http://www.flyblog.info/wp-includes/js/jquery/jquery.js?ver=1.3.2'></script>
<script type="text/javascript">
/* <![CDATA[ */
jQuery.ajax({type:'GET',url:'http://www.flyblog.info/wp-content/plugins/wp-postviews-plus/postviews_plus.php',data:'todowppvp=add&type=/feed&id=1',cache:false,dataType:'script'});
/* ]]> */
</script>
<!-- End Of Script Generated By WP-PostViews Plus -->
	<item>
		<title>关于iPhone开发库引用的问题</title>
		<link>http://www.flyblog.info/catprogramming/427.html</link>
		<comments>http://www.flyblog.info/catprogramming/427.html#comments</comments>
		<pubDate>Fri, 11 Dec 2009 17:18:40 +0000</pubDate>
		<dc:creator>Flyblog</dc:creator>
				<category><![CDATA[编程开发]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[selector]]></category>
		<category><![CDATA[Three20]]></category>

		<guid isPermaLink="false">http://www.flyblog.info/?p=427</guid>
		<description><![CDATA[最近的项目用到了著名的Three20界面库， 程序发布完成结果背Apple拒绝，理由是使用了Private APIs， 没话说，肯定是Three20的问题。
于是获取最新代码，编译之后对可执行文件进行扫描确认没有Private APIs被调用了之后再build最终版本以提交App Store， 不知道是哪根筋不对突然觉得是否应该在真机上编译个release版本再提交，不然又要等若干天，万一被打回又得耽误功夫。
果然，一试吓一跳， 无法运行，原因是Three20中的所有对SDK种类的扩展都没被打包编译进来，运行时无法找到相应的selector，当然就crash了
开始是google搜寻答案，屡试之后，静下心来看看Three20的文档， 看到最后才恍然大悟，原来还需要一个 -all_load 连接选项。添加后编译运行，一切顺利， god。
然后翻阅水果文档，才知道 -all_load link option连接选项是告诉编译器将所连接的库全部包含，而不是用到才引入。


No related posts.
Related posts brought to you by Yet Another Related Posts Plugin.


No related posts.

Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>最近的项目用到了著名的Three20界面库， 程序发布完成结果背Apple拒绝，理由是使用了Private APIs， 没话说，肯定是Three20的问题。</p>
<p>于是获取最新代码，编译之后对可执行文件进行扫描确认没有Private APIs被调用了之后再build最终版本以提交App Store， 不知道是哪根筋不对突然觉得是否应该在真机上编译个release版本再提交，不然又要等若干天，万一被打回又得耽误功夫。</p>
<p>果然，一试吓一跳， 无法运行，原因是Three20中的所有对SDK种类的扩展都没被打包编译进来，运行时无法找到相应的selector，当然就crash了</p>
<p>开始是google搜寻答案，屡试之后，静下心来看看Three20的文档， 看到最后才恍然大悟，原来还需要一个 -all_load 连接选项。添加后编译运行，一切顺利， god。</p>
<p>然后翻阅水果文档，才知道 -all_load link option连接选项是告诉编译器将所连接的库全部包含，而不是用到才引入。</p>


<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.flyblog.info/catprogramming/427.html/feed</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>iPhone开发中的问题整理（一）</title>
		<link>http://www.flyblog.info/catprogramming/423.html</link>
		<comments>http://www.flyblog.info/catprogramming/423.html#comments</comments>
		<pubDate>Fri, 23 Oct 2009 08:11:20 +0000</pubDate>
		<dc:creator>Flyblog</dc:creator>
				<category><![CDATA[编程开发]]></category>
		<category><![CDATA[cocoa]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[iPhone SDK]]></category>
		<category><![CDATA[Objective-C]]></category>
		<category><![CDATA[开发]]></category>

		<guid isPermaLink="false">http://www.flyblog.info/?p=423</guid>
		<description><![CDATA[
<!-- Start Of Script Generated By WP-PostViews Plus -->
<script type="text/javascript">
/* <![CDATA[ */
jQuery.ajax({type:'GET',url:'http://www.flyblog.info/wp-content/plugins/wp-postviews-plus/postviews_plus.php',data:'todowppvp=add&type=/feed&id=1',cache:false,dataType:'script'});
/* ]]> */
</script>
<!-- End Of Script Generated By WP-PostViews Plus -->
看到很刚开始开发iPhone软件的朋友问很多问题，其实同样的问题我也碰到过， 所以抽时间把能想到的或者碰到的问题汇总一下， 一来可以给自己做个备忘也可以和朋友们分享探讨。


Related posts:<ol><li><a href='http://www.flyblog.info/catprogramming/419.html' rel='bookmark' title='Permanent Link: ZipArchive has been updated to version 1.1 (更新至1.1版）'>ZipArchive has been updated to version 1.1 (更新至1.1版）</a> <small>ZipArchive is a wrapper class to compress and uncompress zip...</small></li><li><a href='http://www.flyblog.info/catprogramming/409.html' rel='bookmark' title='Permanent Link: Create custom checkbox style button for iPhone'>Create custom checkbox style button for iPhone</a> <small>Recently, I got a task to develop an application for...</small></li></ol>

Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[
<!-- Start Of Script Generated By WP-PostViews Plus -->
<script type="text/javascript">
/* <![CDATA[ */
jQuery.ajax({type:'GET',url:'http://www.flyblog.info/wp-content/plugins/wp-postviews-plus/postviews_plus.php',data:'todowppvp=add&type=/feed&id=1',cache:false,dataType:'script'});
/* ]]> */
</script>
<!-- End Of Script Generated By WP-PostViews Plus -->
<p>看到很刚开始开发iPhone软件的朋友问很多问题，其实同样的问题我也碰到过， 所以抽时间把能想到的或者碰到的问题汇总一下， 一来可以给自己做个备忘也可以和朋友们分享探讨。</p>
<p>1. iPhone SDK 开发能不能使用C / C++ 语言？</p>
<p>Answer： iPhone SDK的开发的基础框架是基于cocoa库的， Objective-C 是cocoa的开发语言， 但基于Objective-C的特性，在iPhone程序中可以使用C/C++进行功能开发以及使用第三方C/C++库。</p>
<p>2. 如何才能使用 C /C++?</p>
<p>Answer： 当你需要使用C/C++时， 可以将类实现的文件名改为 .mm, 这样编译器就知道改文件中包含C/C++代码 （注：此时在工程属性的编译选项必须设定为根据文件类型或者objective c++或者C++， 具体位置：GCC 4.0 -Language -&gt; Compile Sources As  ）</p>
<p>3.  Objective-C类属性关键字nonatomic时什么意思？</p>
<p>Answer: 这时Objective-C的特性， 改关键字用来告诉编译器在自动生成访问器代码时该如何处理线程安全。默认情况下所有属性都是 atomic也就是线程安全的，但因为运行效率较低。考虑到效率，一般都采用nonatomic，然后自己做线程安全的处理。</p>
<p>4.  如何避免因为内存不足导致程序崩溃？</p>
<p>Answer: iPhone程序可用的内存很小， 苹果官方没有给出明确的上限， 但根据互联网上其它开发人员的总结最多不超过20MB，这一数字未经证实，但我曾碰到过程序在分配13Mb内存的时候就频频crash情况。 所以， 要想避免由于内存不足导致的不稳定，还是按照苹果的建议</p>
<ul>
<li>Load resources lazily， 就是所有资源都是在使用的时候再加载，用完立刻释放。 比如，你的程序需要3张图片在某个View中显示，以往的桌面程序的做法是在程序启动的时候加载该3张图片到内存， 用的时候直接调用内存以提高效率。 但这样的做法在iPhone中不可取，iPhone对于资源的原则是<strong>随用随取，用完释放</strong>。</li>
<li>对象的分配也尽量避免使用autorelease，善用NSAutoreleasePool 内存池。尤其是在循环中。</li>
<li>大数据量采用SQLite存储， 存储快、效率高</li>
<li>绝对避免内存泄露，iPhone程序崩溃往往是拥有内存泄露导致，可以使用xcode-&gt;Run-&gt;Start With Performance Tool -&gt; Leaks 来检查泄露情况</li>
</ul>
<p>5. 如何保存程序中的用户输入信息？</p>
<p>Answer： 有时候需要保存用户输入的信息数据或者程序的状态，最好的方式是采用plist存储。 用plist存储优点甚多，NSArray、NSDictionary等容器类都支持直接输入输出plist格式的文件。 但需要注意的是， 输入、输出的文件格式和相应容器类要保持一致。 也就是说，使用[array writeToFile] 输出的plist文件必须用[array arrayWithContentsOfFile:]来读取，如果混用了array和dictionary则会导致程序崩溃。</p>
<p>6. 如何弹出网络链接对话框？</p>
<p>Answer： 如果程序中用到网络，按照app store的规定需要弹出网络连接对话框提示用户。只需要在Info.plist文件中添加信的条目：UIRequiresPersistentWiFi 类型为Boolean，值为YES即可。</p>
<p>7. 如何显示顶部状态栏中的网络忙指示器？</p>
<p>Answer: 设置 <span style="color: #0000ff;"> networkActivityIndicatorVisible = YES</span>即可， 不需要时将其赋值NO即可</p>
<p>8. 如何在程序图标上显示数字？<a href="http://www.flyblog.info/wp-content/uploads/2009/10/images.jpeg"><img class="alignnone size-full wp-image-424" title="images" src="http://www.flyblog.info/wp-content/uploads/2009/10/images.jpeg" alt="images" width="68" height="85" /></a></p>
<p>Answer: 在程序退出或者改变时修改<span style="color: #0000ff;">[UIApplication sharedApplication].applicationIconBadgeNumber</span>的值即可</p>
<p>9.  如何比较两个NSString字符串是否一样？</p>
<p>Answer: 使用NSString类的 isEqualToString： 方法来判断字符串是否相同，也可以使用[NSStringObject compare:]==NSSameOrder， 注意： isEqual用于判断两个对象是否一样而不是内容</p>
<p>10. 如何改变导航条的背景颜色？</p>
<p>Answer： 如果时在ViewController中修改则使用类似如下代码：</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Monaco;"><span style="white-space: pre;"> </span><span style="font: 10.0px Monaco; color: #aa0d91;">self</span>.navigationController.navigationBar.tintColor = [<span style="color: #5c2699;">UIColor</span> <span style="color: #2e0d6e;">colorWithRed</span>:<span style="font: 10.0px Monaco; color: #1c00cf;">0.03</span> <span style="color: #2e0d6e;">green</span>:<span style="font: 10.0px Monaco; color: #1c00cf;">0.215</span> <span style="color: #2e0d6e;">blue</span>: <span style="font: 10.0px Monaco; color: #1c00cf;">0.298</span> <span style="color: #2e0d6e;">alpha</span>:<span style="font: 10.0px Monaco; color: #1c00cf;">1</span>];</p>


<p>Related posts:<ol><li><a href='http://www.flyblog.info/catprogramming/419.html' rel='bookmark' title='Permanent Link: ZipArchive has been updated to version 1.1 (更新至1.1版）'>ZipArchive has been updated to version 1.1 (更新至1.1版）</a> <small>ZipArchive is a wrapper class to compress and uncompress zip...</small></li><li><a href='http://www.flyblog.info/catprogramming/409.html' rel='bookmark' title='Permanent Link: Create custom checkbox style button for iPhone'>Create custom checkbox style button for iPhone</a> <small>Recently, I got a task to develop an application for...</small></li></ol></p>
<p>Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.flyblog.info/catprogramming/423.html/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>ZipArchive has been updated to version 1.1 (更新至1.1版）</title>
		<link>http://www.flyblog.info/catprogramming/419.html</link>
		<comments>http://www.flyblog.info/catprogramming/419.html#comments</comments>
		<pubDate>Tue, 20 Oct 2009 01:52:02 +0000</pubDate>
		<dc:creator>Flyblog</dc:creator>
				<category><![CDATA[编程开发]]></category>
		<category><![CDATA[cocoa]]></category>
		<category><![CDATA[compress]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[iPhone SDK]]></category>
		<category><![CDATA[Objective-C]]></category>
		<category><![CDATA[uncompress]]></category>
		<category><![CDATA[unzip]]></category>
		<category><![CDATA[zip]]></category>

		<guid isPermaLink="false">http://www.flyblog.info/?p=419</guid>
		<description><![CDATA[
<!-- Start Of Script Generated By WP-PostViews Plus -->
<script type="text/javascript">
/* <![CDATA[ */
jQuery.ajax({type:'GET',url:'http://www.flyblog.info/wp-content/plugins/wp-postviews-plus/postviews_plus.php',data:'todowppvp=add&type=/feed&id=1',cache:false,dataType:'script'});
/* ]]> */
</script>
<!-- End Of Script Generated By WP-PostViews Plus -->
ZipArchive is a wrapper class to compress and uncompress zip files for Objective-C and cocoa use. It's developed based on minizip and zlib. 


Related posts:<ol><li><a href='http://www.flyblog.info/catprogramming/340.html' rel='bookmark' title='Permanent Link: iPhone SDK: 提交AppStore失败原因小结'>iPhone SDK: 提交AppStore失败原因小结</a> <small>这一次提交软件到AppStore 遇到了点麻烦， 编译、生成都没有出什么问题， 但是在iTunesconnect中提交的时候却遇到了问题。 在上传文件的时候被告知Binary没有被正确签名 The binary you uploaded was...</small></li><li><a href='http://www.flyblog.info/catprogramming/409.html' rel='bookmark' title='Permanent Link: Create custom checkbox style button for iPhone'>Create custom checkbox style button for iPhone</a> <small>Recently, I got a task to develop an application for...</small></li><li><a href='http://www.flyblog.info/catinternet/366.html' rel='bookmark' title='Permanent Link: Google Search Ajax API 实现站内搜索'>Google Search Ajax API 实现站内搜索</a> <small>Google search 可以很容易实现站内搜索， 首先你需要到http://code.google.com/apis/ajaxsearch/signup.html 注册API Key。 将下面的代码存为html文件 ?View Code HTML1...</small></li></ol>

Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[
<!-- Start Of Script Generated By WP-PostViews Plus -->
<script type="text/javascript">
/* <![CDATA[ */
jQuery.ajax({type:'GET',url:'http://www.flyblog.info/wp-content/plugins/wp-postviews-plus/postviews_plus.php',data:'todowppvp=add&type=/feed&id=1',cache:false,dataType:'script'});
/* ]]> */
</script>
<!-- End Of Script Generated By WP-PostViews Plus -->
<p>ZipArchive is a wrapper class to compress and uncompress zip files for Objective-C and cocoa use. It&#8217;s developed based on minizip and zlib.  The latest version is 1.1, new feature includes :</p>
<p>✩ create password protected zip files</p>
<p>✩ unzip password protected zip files</p>
<p>To obtain the new version up to date, please visit the project website <a href="http://code.google.com/p/ziparchive/" target="_blank">http://code.google.com/p/ziparchive/</a></p>
<p>ZipArchive 是基于minizip和zlib的Objective－C 类， 用于创建和解压zip格式的压缩文件， 最新版本为1.1， 新增功能如下：</p>
<p>✩ 创建有密码保护的zip文件</p>
<p>✩ 解压有密码保护的zip文件</p>
<p>为了保证获取最新的版本， 请访问该项目网页 <a href="http://code.google.com/p/ziparchive/" target="_blank">http://code.google.com/p/ziparchive/</a></p>


<p>Related posts:<ol><li><a href='http://www.flyblog.info/catprogramming/340.html' rel='bookmark' title='Permanent Link: iPhone SDK: 提交AppStore失败原因小结'>iPhone SDK: 提交AppStore失败原因小结</a> <small>这一次提交软件到AppStore 遇到了点麻烦， 编译、生成都没有出什么问题， 但是在iTunesconnect中提交的时候却遇到了问题。 在上传文件的时候被告知Binary没有被正确签名 The binary you uploaded was...</small></li><li><a href='http://www.flyblog.info/catprogramming/409.html' rel='bookmark' title='Permanent Link: Create custom checkbox style button for iPhone'>Create custom checkbox style button for iPhone</a> <small>Recently, I got a task to develop an application for...</small></li><li><a href='http://www.flyblog.info/catinternet/366.html' rel='bookmark' title='Permanent Link: Google Search Ajax API 实现站内搜索'>Google Search Ajax API 实现站内搜索</a> <small>Google search 可以很容易实现站内搜索， 首先你需要到http://code.google.com/apis/ajaxsearch/signup.html 注册API Key。 将下面的代码存为html文件 ?View Code HTML1...</small></li></ol></p>
<p>Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.flyblog.info/catprogramming/419.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>iPhone 开发最实用网站</title>
		<link>http://www.flyblog.info/catprogramming/417.html</link>
		<comments>http://www.flyblog.info/catprogramming/417.html#comments</comments>
		<pubDate>Mon, 19 Oct 2009 08:51:14 +0000</pubDate>
		<dc:creator>Flyblog</dc:creator>
				<category><![CDATA[编程开发]]></category>

		<guid isPermaLink="false">http://www.flyblog.info/?p=417</guid>
		<description><![CDATA[iPhone越来越普及， 从而越来越多的人加入到了iPhone开发的行列， 还记得大概2年前刚开始iPhone SDK开发的时候苦于四处寻找资料， 当时国内相关内容少的可怜， 只有cocoachina 及论坛。 大多数时候泡在apple 官方论坛。 现在不同了， 各类iPhone相关的网站可谓铺天盖地， 其中内容重复的也不在少数， 个人经常上的只有几个， 在此列出共大家参考：


No related posts.

Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>iPhone越来越普及， 从而越来越多的人加入到了iPhone开发的行列， 还记得大概2年前刚开始iPhone SDK开发的时候苦于四处寻找资料， 当时国内相关内容少的可怜， 只有<a href="http://www.cocoachina.com" target="_blank">cocoachina</a> 及论坛。 大多数时候泡在apple 官方论坛。 现在不同了， 各类iPhone相关的网站可谓铺天盖地， 其中内容重复的也不在少数， 个人经常上的只有几个， 在此列出共大家参考：</p>
<p>英文站点及论坛：</p>
<p><a href="http://www.cocoadevcentral.com/" target="_blank">http://www.cocoadevcentral.com/</a> 绝对钻石级入门教学网站。 从Object－C到cocoa，再到xcode以及InterfaceBuilder，由浅入深剖析的非常清楚，难得的好网站</p>
<p><a href="http://www.iphonedevsdk.com/forum" target="_blank">http://www.iphonedevsdk.com/forum</a> 一开始就汇聚众多高手的网站，内容大多非常有价值，现在成员多了估计水分变大，但仍然是学习、提问的好地方</p>
<p><a href="http://stackoverflow.com" target="_blank">http://stackoverflow.com</a> 包括各种语言的技术论坛， 非常有含金量， 很多疑难问题都能在此得到高手的解答</p>
<p><a href="http://discussions.apple.com" target="_blank">Apple官方论坛</a> 官方论坛， 是个解决问题的好地方:)</p>
<p>中文站点：</p>
<p><a href="http://www.cocoachina.com">cocoachina</a> 几乎每天都去的网站，高手众多，现在潜水严重。</p>
<p>如果其它好的站点， 希望大家分享;)</p>


<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.flyblog.info/catprogramming/417.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Create custom checkbox style button for iPhone</title>
		<link>http://www.flyblog.info/catprogramming/409.html</link>
		<comments>http://www.flyblog.info/catprogramming/409.html#comments</comments>
		<pubDate>Mon, 19 Oct 2009 08:19:39 +0000</pubDate>
		<dc:creator>Flyblog</dc:creator>
				<category><![CDATA[编程开发]]></category>
		<category><![CDATA[CheckBox Button]]></category>
		<category><![CDATA[cocoa]]></category>
		<category><![CDATA[custom view]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[iPhone SDK]]></category>
		<category><![CDATA[Objective-C]]></category>

		<guid isPermaLink="false">http://www.flyblog.info/?p=409</guid>
		<description><![CDATA[
<!-- Start Of Script Generated By WP-PostViews Plus -->
<script type="text/javascript">
/* <![CDATA[ */
jQuery.ajax({type:'GET',url:'http://www.flyblog.info/wp-content/plugins/wp-postviews-plus/postviews_plus.php',data:'todowppvp=add&type=/feed&id=1',cache:false,dataType:'script'});
/* ]]> */
</script>
<!-- End Of Script Generated By WP-PostViews Plus -->
Recently, I got a task to develop an application for iPhone. In the application,  there are some optional choices for user to decide further processes. The first idea jumps out from my head is something like button with a checkbox just the same as other desktop platforms, but unfortunately, iPhone SDK doesn't provide such view. The only official choice is the ON&#124;OFF switch view,  but it really can't represent the actually meaning of the options. So comes out the idea of writing  custom checkbox style button.


Related posts:<ol><li><a href='http://www.flyblog.info/catprogramming/392.html' rel='bookmark' title='Permanent Link: iPhone SDK开发： 如何上传图片文件到服务器'>iPhone SDK开发： 如何上传图片文件到服务器</a> <small>现成的代码， 如果不想压缩，可以去掉zlib 头文件 ?View Code OBJC1 2 3 4 5...</small></li><li><a href='http://www.flyblog.info/catprogramming/335.html' rel='bookmark' title='Permanent Link: iPhone SDK 开发：如何判断WIFI链接'>iPhone SDK 开发：如何判断WIFI链接</a> <small>iPhone SDK提供了系统对话框用来判断是否有有效的WIFI链接， 这种情况已经在 iPhone SDK开发：如何显示WiFi提示 介绍过。 但是有时候如果打开了GPRS/Edge网络， 则不会弹出wifi对话框， 如果程序需要根据链接类型来传输不同的内容则需要判断当前有效链接是否为WIFI， 正好我的程序中用到就写了一个函数判断当前有效链接是否为WiFi...</small></li><li><a href='http://www.flyblog.info/catprogramming/353.html' rel='bookmark' title='Permanent Link: iPhone SDK 开发: Facebook Connect应用'>iPhone SDK 开发: Facebook Connect应用</a> <small>如果你正在开发iPhone上的Facebook相关的应用软件，那么根据Facebook的相关使用协议，必须通过官方提供的api来进行访问， 否则会涉及倒版权问题。 Facebook的应用开发采用和google类似的Session Token的方式， 但比google 更复杂。 在用户登陆的过程中， Facebook强制用户交互操作已完成登陆，如果用户/密码验证成功，服务器会返回session key 和...</small></li></ol>

Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[
<!-- Start Of Script Generated By WP-PostViews Plus -->
<script type="text/javascript">
/* <![CDATA[ */
jQuery.ajax({type:'GET',url:'http://www.flyblog.info/wp-content/plugins/wp-postviews-plus/postviews_plus.php',data:'todowppvp=add&type=/feed&id=1',cache:false,dataType:'script'});
/* ]]> */
</script>
<!-- End Of Script Generated By WP-PostViews Plus -->
<p>Recently, I got a task to develop an application for iPhone. In the application,  there are some optional choices for user to decide further processes. The first idea jumps out from my head is something like button with a checkbox just the same as other desktop platforms, but unfortunately, iPhone SDK doesn&#8217;t provide such view. The only official choice is the ON|OFF switch view,  but it really can&#8217;t represent the actually meaning of the options. So comes out the idea of writing  custom checkbox style button.</p>
<p>It&#8217;s really easy to implement. What we need is two images which are statuses for check and uncheck.  Here are the runtime screenshots:</p>
<p><img class="alignnone size-full wp-image-410" title="checkbutton" src="http://www.flyblog.info/wp-content/uploads/2009/10/checkbutton.jpg" alt="checkbutton" width="202" height="73" /> <img class="alignnone size-full wp-image-411" title="uncheckbutton" src="http://www.flyblog.info/wp-content/uploads/2009/10/uncheckbutton.jpg" alt="uncheckbutton" width="225" height="70" /></p>
<p>The class  for Checkbox button  is CheckButton,  it&#8217;s inherited from UIButton,  look at the declaration:</p>

<div class="wp_codebox_msgheader wp_codebox_hide"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p409code6'); return false;">View Code</a> OBJC</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p4096"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
</pre></td><td class="code" id="p409code6"><pre class="objc" style="font-family:monospace;"><span style="color: #6e371a;">#import </span>
&nbsp;
<span style="color: #a61390;">@interface</span> CheckButton <span style="color: #002200;">:</span> UIButton <span style="color: #002200;">&#123;</span>
	<span style="color: #a61390;">BOOL</span>		_checked;
<span style="color: #002200;">&#125;</span>
&nbsp;
<span style="color: #a61390;">@property</span> <span style="color: #002200;">&#40;</span>nonatomic, setter<span style="color: #002200;">=</span>setChecked<span style="color: #002200;">&#41;</span> <span style="color: #a61390;">BOOL</span> checked;
&nbsp;
<span style="color: #002200;">-</span><span style="color: #002200;">&#40;</span><span style="color: #a61390;">void</span><span style="color: #002200;">&#41;</span> setChecked<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><span style="color: #a61390;">BOOL</span><span style="color: #002200;">&#41;</span> check;
<span style="color: #a61390;">@end</span></pre></td></tr></table></div>

<p>Implementation:</p>

<div class="wp_codebox_msgheader wp_codebox_hide"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p409code7'); return false;">View Code</a> OJBC</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p4097"><td class="line_numbers"><pre>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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
</pre></td><td class="code" id="p409code7"><pre class="ojbc" style="font-family:monospace;">#import &quot;CheckButton.h&quot;
&nbsp;
@implementation CheckButton
@synthesize checked = _checked;
&nbsp;
-(id) init
{
	if( self=[super init] )
	{
		self.checked = NO;
		[self addTarget:self action:@selector(OnCheck:) forControlEvents:UIControlEventTouchUpInside];
	}
	return self;
}
&nbsp;
-(void) awakeFromNib
{
	self.checked = NO;
	[self addTarget:self action:@selector(OnCheck:) forControlEvents:UIControlEventTouchUpInside];
}
&nbsp;
-(void) dealloc
{
	[super dealloc];
}
&nbsp;
-(void) setChecked:(BOOL) check
{
	_checked = check;
	if( _checked )
	{
		UIImage* img = [UIImage imageNamed:@&quot;check.png&quot;];
		[self setImage:img forState:UIControlStateNormal];
	}
	else
	{
		UIImage* img = [UIImage imageNamed:@&quot;uncheck.png&quot;];
		[self setImage:img forState:UIControlStateNormal];
	}
}
&nbsp;
-(void) OnCheck:(id) sender
{
	self.checked = !_checked;
}
&nbsp;
@end</pre></td></tr></table></div>

<p>To use the class, import the header where contains the button, and declare a IBOutlet with type of &#8220;CheckButton&#8221;, and connect the IBOutlet in InterfaceBuilder to the member as shown below:<br />
<img class="alignnone size-full wp-image-412" title="import" src="http://www.flyblog.info/wp-content/uploads/2009/10/import.jpg" alt="import" width="567" height="215" /></p>
<p>This is simple but exactly meet my requirement. Of course, someone wants to include title text of the button within the button class,  it&#8217;s sure to be easy to do <img src='http://www.flyblog.info/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p><a href="http://www.flyblog.info/wp-content/uploads/2009/10/CheckBoxButton.zip">Here is the sample project zip file.</a></p>


<p>Related posts:<ol><li><a href='http://www.flyblog.info/catprogramming/392.html' rel='bookmark' title='Permanent Link: iPhone SDK开发： 如何上传图片文件到服务器'>iPhone SDK开发： 如何上传图片文件到服务器</a> <small>现成的代码， 如果不想压缩，可以去掉zlib 头文件 ?View Code OBJC1 2 3 4 5...</small></li><li><a href='http://www.flyblog.info/catprogramming/335.html' rel='bookmark' title='Permanent Link: iPhone SDK 开发：如何判断WIFI链接'>iPhone SDK 开发：如何判断WIFI链接</a> <small>iPhone SDK提供了系统对话框用来判断是否有有效的WIFI链接， 这种情况已经在 iPhone SDK开发：如何显示WiFi提示 介绍过。 但是有时候如果打开了GPRS/Edge网络， 则不会弹出wifi对话框， 如果程序需要根据链接类型来传输不同的内容则需要判断当前有效链接是否为WIFI， 正好我的程序中用到就写了一个函数判断当前有效链接是否为WiFi...</small></li><li><a href='http://www.flyblog.info/catprogramming/353.html' rel='bookmark' title='Permanent Link: iPhone SDK 开发: Facebook Connect应用'>iPhone SDK 开发: Facebook Connect应用</a> <small>如果你正在开发iPhone上的Facebook相关的应用软件，那么根据Facebook的相关使用协议，必须通过官方提供的api来进行访问， 否则会涉及倒版权问题。 Facebook的应用开发采用和google类似的Session Token的方式， 但比google 更复杂。 在用户登陆的过程中， Facebook强制用户交互操作已完成登陆，如果用户/密码验证成功，服务器会返回session key 和...</small></li></ol></p>
<p>Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.flyblog.info/catprogramming/409.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>全VB代码生成小说， 牛</title>
		<link>http://www.flyblog.info/catinternet/407.html</link>
		<comments>http://www.flyblog.info/catinternet/407.html#comments</comments>
		<pubDate>Mon, 19 Oct 2009 07:32:14 +0000</pubDate>
		<dc:creator>Flyblog</dc:creator>
				<category><![CDATA[互联网络]]></category>

		<guid isPermaLink="false">http://www.flyblog.info/?p=407</guid>
		<description><![CDATA[近日 ， 由网友编写的VB程序自动生成的小说 《宇宙巨校闪级生》正式上线， 该小说长达一亿七千万字，文本字节容量高达340 MB， 全部共111部，分1111卷， 同时创下无数个“最”。 以下是一段作者的自述：
本书是用ＶＢ语言编写的魔幻神侠小说，适合所有年龄段的读者阅读。本书共有１１１部，分为１１１１卷，按纯文本（txt格式）计算，本书的总字数超过３４０兆，如换成中文计算：总字数应该不会少于一亿七千万字。这次公开的是本书中的前二十部，后面的九十一部及未来的升级版、简化版和第一人称版《蘑菇王子传》将在找到理想的合作者之后再陆续推出。由于本书的写作过程是全自动完成，所以本书至少创造了五个世界之最。。。
有兴趣的可以看一下http://html.hjsm.tom.com/html/new_book/29/421/d82f1776b0abe00ba37f5d27b3c6.html


No related posts.
Related posts brought to you by Yet Another Related Posts Plugin.


No related posts.

Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>近日 ， 由网友编写的VB程序自动生成的小说 《宇宙巨校闪级生》正式上线， 该小说长达一亿七千万字，文本字节容量高达340 MB， 全部共111部，分1111卷， 同时创下无数个“最”。 以下是一段作者的自述：</p>
<blockquote><p><span style="color: #000080;">本书是用ＶＢ语言编写的魔幻神侠小说，适合所有年龄段的读者阅读。本书共有１１１部，分为１１１１卷，按纯文本（txt格式）计算，本书的总字数超过３４０兆，如换成中文计算：总字数应该不会少于一亿七千万字。这次公开的是本书中的前二十部，后面的九十一部及未来的升级版、简化版和第一人称版《蘑菇王子传》将在找到理想的合作者之后再陆续推出。由于本书的写作过程是全自动完成，所以本书至少创造了五个世界之最。。。</span></p></blockquote>
<p>有兴趣的可以看一下<a href="http://html.hjsm.tom.com/html/new_book/29/421/d82f1776b0abe00ba37f5d27b3c6.html" target="_blank">http://html.hjsm.tom.com/html/new_book/29/421/d82f1776b0abe00ba37f5d27b3c6.html</a></p>


<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.flyblog.info/catinternet/407.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>升级到 iDeneb 10.5.8，并解决xcode调试断点问题</title>
		<link>http://www.flyblog.info/catprogramming/403.html</link>
		<comments>http://www.flyblog.info/catprogramming/403.html#comments</comments>
		<pubDate>Thu, 15 Oct 2009 01:27:25 +0000</pubDate>
		<dc:creator>Flyblog</dc:creator>
				<category><![CDATA[编程开发]]></category>
		<category><![CDATA[iDeneb 10.5.8]]></category>
		<category><![CDATA[XCode]]></category>
		<category><![CDATA[断点]]></category>

		<guid isPermaLink="false">http://www.flyblog.info/?p=403</guid>
		<description><![CDATA[Snow Leopard正式版已经发布有一段时间了，看了一下iHackintosh的介绍，升级到Snow Leopard需要一块新的硬盘，作罢。 今天抽空将iDeneb系统升级到10.5.8， 升级过程非常简单，如果已经是10.5.7系统就下载官方更新包Delta update（274MB)， 如果是低版本则下载Combo update（759MB)。 在升级之前，还需要下载osx86tools。


No related posts.

Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<div>
<p>Snow Leopard正式版已经发布有一段时间了，看了一下iHackintosh的介绍，升级到Snow Leopard需要一块新的硬盘，作罢。 今天抽空将iDeneb系统升级到10.5.8， 升级过程非常简单，如果已经是10.5.7系统就下载官方更新包<a href="http://www.ihackintosh.com/2009/08/download-mac-os-x-1058-software-update/">Delta update</a>（274MB)， 如果是低版本则下载<a href="http://www.ihackintosh.com/2009/08/download-mac-os-x-1058-software-update/">Combo update</a>（759MB)。 在升级之前，还需要下载<a href="http://osx86tools.googlecode.com/files/OSX86Tools_1.0.150.zip">osx86tools</a>。</p>
<p>在升级之前还需要注意的是备份kext驱动程序， 每次改动之前都做备份是个很好的习惯。 然后按照下面的步骤进行升级，</p>
<p>1. 下载并安装 <a href="http://forum.insanelymac.com/index.php?act=attach&amp;type=post&amp;id=41446" target="_blank">Disabler.kext </a> （如果是用osx86tools安装，切记不要重新启动）</p>
<p>2. 下载并安装 <a href="http://rapidshare.de/files/48042786/dsmos.kext.zip.html" target="_blank">dsmos.kext</a></p>
<p>3. 重新启动系统</p>
<p>4. 备份所有的kext， 以便出错后恢复</p>
<blockquote><p>sudo cp -rf /System/Library/Extensions /System/Library/Extensions_old</p></blockquote>
<p>5. 打开下载的官方升级程序， 成功后会看到安装成功，是否重新启动的页面，<strong>此时不要重新启动，</strong>直接进行下一步</p>
<p>6. 运行 osx86tools， 勾选Check repair permissions ， Set kext permissions ， Clear extensions cache 三项， 然后点击“Run selected tasks&#8221;,安装结束会提示重新启动，如果没重启就自己重启系统</p>
<p>在启动时输入参数 －v 查看出错信息，如果一切正常则升级成功。</p>
<p>关于xcode调试时断点不停的问题， 新的voodoo内核虽然解决了断点问题， 但是不能进行step over 和step in等详细调试操作， 网上有人说在启动时输入启动参数： std_dyld=1，我试过但没有用， 做好发现输入参数还需要添加几项，正确的参数应该为：</p>
<blockquote><p>busratio=20 cpus=1 std_dyld=1</p></blockquote>
<p>这样在xcode中调试时，断点就可以正常工作了， 而且可以进行step over 等调试操作</p></div>


<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.flyblog.info/catprogramming/403.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>根据经纬度计算两点之间的距离代码</title>
		<link>http://www.flyblog.info/catprogramming/400.html</link>
		<comments>http://www.flyblog.info/catprogramming/400.html#comments</comments>
		<pubDate>Thu, 10 Sep 2009 07:40:18 +0000</pubDate>
		<dc:creator>Flyblog</dc:creator>
				<category><![CDATA[编程开发]]></category>
		<category><![CDATA[代码]]></category>
		<category><![CDATA[经纬度]]></category>
		<category><![CDATA[距离]]></category>

		<guid isPermaLink="false">http://www.flyblog.info/?p=400</guid>
		<description><![CDATA[今天看到cocoachina有人问起这个问题， 正好把好久以前的一段代码发了上来， 这段代码已经经过验证，精度还是可以保障的， 对于不同的应用需要更换调整地球半径值 ，先看代码

?View Code OBJC1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#define PI 3.1415926
&#160;
double LantitudeLongitudeDist&#40;double lon1,double lat1,
							  double lon2,double lat2&#41;
&#123;
	double er = 6378137; // 6378700.0f;
	//ave. radius = 6371.315 (someone said more accurate is 6366.707)
	//equatorial radius = 6378.388
	//nautical mile = 1.15078
	double radlat1 = PI*lat1/180.0f;
	double radlat2 = PI*lat2/180.0f;
&#160;
	//now long.
	double radlong1 = PI*lon1/180.0f;
	double radlong2 = PI*lon2/180.0f;
&#160;
	if&#40; radlat1 &#38;lt; 0 &#41; radlat1 = [...]


No related posts.

Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>今天看到cocoachina有人问起这个问题， 正好把好久以前的一段代码发了上来， 这段代码已经经过验证，精度还是可以保障的， 对于不同的应用需要更换调整地球半径值 ，先看代码<span id="more-400"></span></p>

<div class="wp_codebox_msgheader wp_codebox_hide"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p400code12'); return false;">View Code</a> OBJC</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p40012"><td class="line_numbers"><pre>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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
</pre></td><td class="code" id="p400code12"><pre class="objc" style="font-family:monospace;"><span style="color: #6e371a;">#define PI 3.1415926</span>
&nbsp;
<span style="color: #a61390;">double</span> LantitudeLongitudeDist<span style="color: #002200;">&#40;</span><span style="color: #a61390;">double</span> lon1,<span style="color: #a61390;">double</span> lat1,
							  <span style="color: #a61390;">double</span> lon2,<span style="color: #a61390;">double</span> lat2<span style="color: #002200;">&#41;</span>
<span style="color: #002200;">&#123;</span>
	<span style="color: #a61390;">double</span> er <span style="color: #002200;">=</span> <span style="color: #2400d9;">6378137</span>; <span style="color: #11740a; font-style: italic;">// 6378700.0f;</span>
	<span style="color: #11740a; font-style: italic;">//ave. radius = 6371.315 (someone said more accurate is 6366.707)</span>
	<span style="color: #11740a; font-style: italic;">//equatorial radius = 6378.388</span>
	<span style="color: #11740a; font-style: italic;">//nautical mile = 1.15078</span>
	<span style="color: #a61390;">double</span> radlat1 <span style="color: #002200;">=</span> PI<span style="color: #002200;">*</span>lat1<span style="color: #002200;">/</span>180.0f;
	<span style="color: #a61390;">double</span> radlat2 <span style="color: #002200;">=</span> PI<span style="color: #002200;">*</span>lat2<span style="color: #002200;">/</span>180.0f;
&nbsp;
	<span style="color: #11740a; font-style: italic;">//now long.</span>
	<span style="color: #a61390;">double</span> radlong1 <span style="color: #002200;">=</span> PI<span style="color: #002200;">*</span>lon1<span style="color: #002200;">/</span>180.0f;
	<span style="color: #a61390;">double</span> radlong2 <span style="color: #002200;">=</span> PI<span style="color: #002200;">*</span>lon2<span style="color: #002200;">/</span>180.0f;
&nbsp;
	<span style="color: #a61390;">if</span><span style="color: #002200;">&#40;</span> radlat1 <span style="color: #002200;">&amp;</span>lt; 0 <span style="color: #002200;">&#41;</span> radlat1 <span style="color: #002200;">=</span> PI<span style="color: #002200;">/</span>2 <span style="color: #002200;">+</span> <span style="color: #a61390;">fabs</span><span style="color: #002200;">&#40;</span>radlat1<span style="color: #002200;">&#41;</span>;<span style="color: #11740a; font-style: italic;">// south</span>
	<span style="color: #a61390;">if</span><span style="color: #002200;">&#40;</span> radlat1 <span style="color: #002200;">&amp;</span>gt; 0 <span style="color: #002200;">&#41;</span> radlat1 <span style="color: #002200;">=</span> PI<span style="color: #002200;">/</span>2 <span style="color: #002200;">-</span> <span style="color: #a61390;">fabs</span><span style="color: #002200;">&#40;</span>radlat1<span style="color: #002200;">&#41;</span>;<span style="color: #11740a; font-style: italic;">// north</span>
	<span style="color: #a61390;">if</span><span style="color: #002200;">&#40;</span> radlong1 <span style="color: #002200;">&amp;</span>lt; 0 <span style="color: #002200;">&#41;</span> radlong1 <span style="color: #002200;">=</span> PI<span style="color: #002200;">*</span>2 <span style="color: #002200;">-</span> <span style="color: #a61390;">fabs</span><span style="color: #002200;">&#40;</span>radlong1<span style="color: #002200;">&#41;</span>;<span style="color: #11740a; font-style: italic;">//west</span>
&nbsp;
	<span style="color: #a61390;">if</span><span style="color: #002200;">&#40;</span> radlat2 <span style="color: #002200;">&amp;</span>lt; 0 <span style="color: #002200;">&#41;</span> radlat2 <span style="color: #002200;">=</span> PI<span style="color: #002200;">/</span>2 <span style="color: #002200;">+</span> <span style="color: #a61390;">fabs</span><span style="color: #002200;">&#40;</span>radlat2<span style="color: #002200;">&#41;</span>;<span style="color: #11740a; font-style: italic;">// south</span>
	<span style="color: #a61390;">if</span><span style="color: #002200;">&#40;</span> radlat2 <span style="color: #002200;">&amp;</span>gt; 0 <span style="color: #002200;">&#41;</span> radlat2 <span style="color: #002200;">=</span> PI<span style="color: #002200;">/</span>2 <span style="color: #002200;">-</span> <span style="color: #a61390;">fabs</span><span style="color: #002200;">&#40;</span>radlat2<span style="color: #002200;">&#41;</span>;<span style="color: #11740a; font-style: italic;">// north</span>
	<span style="color: #a61390;">if</span><span style="color: #002200;">&#40;</span> radlong2 <span style="color: #002200;">&amp;</span>lt; 0 <span style="color: #002200;">&#41;</span> radlong2 <span style="color: #002200;">=</span> PI<span style="color: #002200;">*</span>2 <span style="color: #002200;">-</span> <span style="color: #a61390;">fabs</span><span style="color: #002200;">&#40;</span>radlong2<span style="color: #002200;">&#41;</span>;<span style="color: #11740a; font-style: italic;">// west</span>
&nbsp;
	<span style="color: #11740a; font-style: italic;">//spherical coordinates x=r*cos(ag)sin(at), y=r*sin(ag)*sin(at), z=r*cos(at)</span>
	<span style="color: #11740a; font-style: italic;">//zero ag is up so reverse lat</span>
	<span style="color: #a61390;">double</span> x1 <span style="color: #002200;">=</span> er <span style="color: #002200;">*</span> <span style="color: #a61390;">cos</span><span style="color: #002200;">&#40;</span>radlong1<span style="color: #002200;">&#41;</span> <span style="color: #002200;">*</span> <span style="color: #a61390;">sin</span><span style="color: #002200;">&#40;</span>radlat1<span style="color: #002200;">&#41;</span>;
	<span style="color: #a61390;">double</span> y1 <span style="color: #002200;">=</span> er <span style="color: #002200;">*</span> <span style="color: #a61390;">sin</span><span style="color: #002200;">&#40;</span>radlong1<span style="color: #002200;">&#41;</span> <span style="color: #002200;">*</span> <span style="color: #a61390;">sin</span><span style="color: #002200;">&#40;</span>radlat1<span style="color: #002200;">&#41;</span>;
	<span style="color: #a61390;">double</span> z1 <span style="color: #002200;">=</span> er <span style="color: #002200;">*</span> <span style="color: #a61390;">cos</span><span style="color: #002200;">&#40;</span>radlat1<span style="color: #002200;">&#41;</span>;
&nbsp;
	<span style="color: #a61390;">double</span> x2 <span style="color: #002200;">=</span> er <span style="color: #002200;">*</span> <span style="color: #a61390;">cos</span><span style="color: #002200;">&#40;</span>radlong2<span style="color: #002200;">&#41;</span> <span style="color: #002200;">*</span> <span style="color: #a61390;">sin</span><span style="color: #002200;">&#40;</span>radlat2<span style="color: #002200;">&#41;</span>;
	<span style="color: #a61390;">double</span> y2 <span style="color: #002200;">=</span> er <span style="color: #002200;">*</span> <span style="color: #a61390;">sin</span><span style="color: #002200;">&#40;</span>radlong2<span style="color: #002200;">&#41;</span> <span style="color: #002200;">*</span> <span style="color: #a61390;">sin</span><span style="color: #002200;">&#40;</span>radlat2<span style="color: #002200;">&#41;</span>;
	<span style="color: #a61390;">double</span> z2 <span style="color: #002200;">=</span> er <span style="color: #002200;">*</span> <span style="color: #a61390;">cos</span><span style="color: #002200;">&#40;</span>radlat2<span style="color: #002200;">&#41;</span>;
&nbsp;
	<span style="color: #a61390;">double</span> d <span style="color: #002200;">=</span> <span style="color: #a61390;">sqrt</span><span style="color: #002200;">&#40;</span><span style="color: #002200;">&#40;</span>x1<span style="color: #002200;">-</span>x2<span style="color: #002200;">&#41;</span><span style="color: #002200;">*</span><span style="color: #002200;">&#40;</span>x1<span style="color: #002200;">-</span>x2<span style="color: #002200;">&#41;</span><span style="color: #002200;">+</span><span style="color: #002200;">&#40;</span>y1<span style="color: #002200;">-</span>y2<span style="color: #002200;">&#41;</span><span style="color: #002200;">*</span><span style="color: #002200;">&#40;</span>y1<span style="color: #002200;">-</span>y2<span style="color: #002200;">&#41;</span><span style="color: #002200;">+</span><span style="color: #002200;">&#40;</span>z1<span style="color: #002200;">-</span>z2<span style="color: #002200;">&#41;</span><span style="color: #002200;">*</span><span style="color: #002200;">&#40;</span>z1<span style="color: #002200;">-</span>z2<span style="color: #002200;">&#41;</span><span style="color: #002200;">&#41;</span>;
&nbsp;
	<span style="color: #11740a; font-style: italic;">//side, side, side, law of cosines and arccos</span>
	<span style="color: #a61390;">double</span> theta <span style="color: #002200;">=</span> <span style="color: #a61390;">acos</span><span style="color: #002200;">&#40;</span><span style="color: #002200;">&#40;</span>er<span style="color: #002200;">*</span>er<span style="color: #002200;">+</span>er<span style="color: #002200;">*</span>er<span style="color: #002200;">-</span>d<span style="color: #002200;">*</span>d<span style="color: #002200;">&#41;</span><span style="color: #002200;">/</span><span style="color: #002200;">&#40;</span>2<span style="color: #002200;">*</span>er<span style="color: #002200;">*</span>er<span style="color: #002200;">&#41;</span><span style="color: #002200;">&#41;</span>;
	<span style="color: #a61390;">double</span> dist  <span style="color: #002200;">=</span> theta<span style="color: #002200;">*</span>er;
&nbsp;
	<span style="color: #a61390;">return</span> dist;
<span style="color: #002200;">&#125;</span></pre></td></tr></table></div>

<p>其中er 就是地球椭球半径，对于google map使用 6378137 就可以了。 函数的调用非常简单， 几乎使用任何平台:)</p>


<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.flyblog.info/catprogramming/400.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>8月最新namecheap的打折代码coupon code</title>
		<link>http://www.flyblog.info/catinternet/396.html</link>
		<comments>http://www.flyblog.info/catinternet/396.html#comments</comments>
		<pubDate>Tue, 18 Aug 2009 01:21:39 +0000</pubDate>
		<dc:creator>Flyblog</dc:creator>
				<category><![CDATA[互联网络]]></category>
		<category><![CDATA[namecheap]]></category>
		<category><![CDATA[域名注册]]></category>
		<category><![CDATA[打折代码]]></category>
		<category><![CDATA[折扣]]></category>

		<guid isPermaLink="false">http://www.flyblog.info/?p=396</guid>
		<description><![CDATA[August Coupon Code
August’s coupon code for new domains is SOLARSEA.  Save money on all your new domains at our website and don’t forget to pass this coupon code on to your friends so they can save money on their domains as well.
And as always, thank you for using NameCheap! 
8月最新的namecheap的coupon code ： SOLARSEA.


No related [...]


No related posts.

Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>August Coupon Code</p>
<p>August’s coupon code for new domains is <strong>SOLARSEA</strong>.  Save money on all your new domains at our website and don’t forget to pass this coupon code on to your friends so they can save money on their domains as well.</p>
<p>And as always, thank you for using NameCheap! </p>
<p>8月最新的namecheap的coupon code ： <strong>SOLARSEA</strong>.</p>


<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.flyblog.info/catinternet/396.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>iPhone SDK开发： 如何上传图片文件到服务器</title>
		<link>http://www.flyblog.info/catprogramming/392.html</link>
		<comments>http://www.flyblog.info/catprogramming/392.html#comments</comments>
		<pubDate>Wed, 05 Aug 2009 02:54:44 +0000</pubDate>
		<dc:creator>Flyblog</dc:creator>
				<category><![CDATA[编程开发]]></category>
		<category><![CDATA[iPhone SDK]]></category>
		<category><![CDATA[to server]]></category>
		<category><![CDATA[上传文件，upload picture]]></category>

		<guid isPermaLink="false">http://www.flyblog.info/?p=392</guid>
		<description><![CDATA[
<!-- Start Of Script Generated By WP-PostViews Plus -->
<script type="text/javascript">
/* <![CDATA[ */
jQuery.ajax({type:'GET',url:'http://www.flyblog.info/wp-content/plugins/wp-postviews-plus/postviews_plus.php',data:'todowppvp=add&type=/feed&id=1',cache:false,dataType:'script'});
/* ]]> */
</script>
<!-- End Of Script Generated By WP-PostViews Plus -->

<!-- Start Of Script Generated By WP-PostViews Plus -->
<script type="text/javascript">
/* <![CDATA[ */
jQuery.ajax({type:'GET',url:'http://www.flyblog.info/wp-content/plugins/wp-postviews-plus/postviews_plus.php',data:'todowppvp=add&type=/feed&id=1',cache:false,dataType:'script'});
/* ]]> */
</script>
<!-- End Of Script Generated By WP-PostViews Plus -->
现成的代码， 如果不想压缩，可以去掉zlib 
头文件

?View Code OBJC1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
@interface EPUploader : NSObject &#123;
    NSURL *serverURL;
    NSString *filePath;
    id delegate;
    SEL doneSelector;
    SEL errorSelector;
&#160;
    BOOL uploadDidSucceed;
&#125;
&#160;
-   &#40;id&#41;initWithURL: &#40;NSURL *&#41;serverURL
        filePath: &#40;NSString *&#41;filePath
  [...]


Related posts:<ol><li><a href='http://www.flyblog.info/catprogramming/335.html' rel='bookmark' title='Permanent Link: iPhone SDK 开发：如何判断WIFI链接'>iPhone SDK 开发：如何判断WIFI链接</a> <small>iPhone SDK提供了系统对话框用来判断是否有有效的WIFI链接， 这种情况已经在 iPhone SDK开发：如何显示WiFi提示 介绍过。 但是有时候如果打开了GPRS/Edge网络， 则不会弹出wifi对话框， 如果程序需要根据链接类型来传输不同的内容则需要判断当前有效链接是否为WIFI， 正好我的程序中用到就写了一个函数判断当前有效链接是否为WiFi...</small></li><li><a href='http://www.flyblog.info/catprogramming/409.html' rel='bookmark' title='Permanent Link: Create custom checkbox style button for iPhone'>Create custom checkbox style button for iPhone</a> <small>Recently, I got a task to develop an application for...</small></li><li><a href='http://www.flyblog.info/catprogramming/353.html' rel='bookmark' title='Permanent Link: iPhone SDK 开发: Facebook Connect应用'>iPhone SDK 开发: Facebook Connect应用</a> <small>如果你正在开发iPhone上的Facebook相关的应用软件，那么根据Facebook的相关使用协议，必须通过官方提供的api来进行访问， 否则会涉及倒版权问题。 Facebook的应用开发采用和google类似的Session Token的方式， 但比google 更复杂。 在用户登陆的过程中， Facebook强制用户交互操作已完成登陆，如果用户/密码验证成功，服务器会返回session key 和...</small></li></ol>

Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[
<!-- Start Of Script Generated By WP-PostViews Plus -->
<script type="text/javascript">
/* <![CDATA[ */
jQuery.ajax({type:'GET',url:'http://www.flyblog.info/wp-content/plugins/wp-postviews-plus/postviews_plus.php',data:'todowppvp=add&type=/feed&id=1',cache:false,dataType:'script'});
/* ]]> */
</script>
<!-- End Of Script Generated By WP-PostViews Plus -->
<p>现成的代码， 如果不想压缩，可以去掉zlib <span id="more-392"></span></p>
<p>头文件</p>

<div class="wp_codebox_msgheader wp_codebox_hide"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p392code16'); return false;">View Code</a> OBJC</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p39216"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
</pre></td><td class="code" id="p392code16"><pre class="objc" style="font-family:monospace;"><span style="color: #a61390;">@interface</span> EPUploader <span style="color: #002200;">:</span> <span style="color: #400080;">NSObject</span> <span style="color: #002200;">&#123;</span>
    <span style="color: #400080;">NSURL</span> <span style="color: #002200;">*</span>serverURL;
    <span style="color: #400080;">NSString</span> <span style="color: #002200;">*</span>filePath;
    <span style="color: #a61390;">id</span> delegate;
    <span style="color: #a61390;">SEL</span> doneSelector;
    <span style="color: #a61390;">SEL</span> errorSelector;
&nbsp;
    <span style="color: #a61390;">BOOL</span> uploadDidSucceed;
<span style="color: #002200;">&#125;</span>
&nbsp;
<span style="color: #002200;">-</span>   <span style="color: #002200;">&#40;</span><span style="color: #a61390;">id</span><span style="color: #002200;">&#41;</span>initWithURL<span style="color: #002200;">:</span> <span style="color: #002200;">&#40;</span><span style="color: #400080;">NSURL</span> <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>serverURL
        filePath<span style="color: #002200;">:</span> <span style="color: #002200;">&#40;</span><span style="color: #400080;">NSString</span> <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>filePath
        delegate<span style="color: #002200;">:</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">id</span><span style="color: #002200;">&#41;</span>delegate
        doneSelector<span style="color: #002200;">:</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">SEL</span><span style="color: #002200;">&#41;</span>doneSelector
        errorSelector<span style="color: #002200;">:</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">SEL</span><span style="color: #002200;">&#41;</span>errorSelector;
&nbsp;
<span style="color: #002200;">-</span>   <span style="color: #002200;">&#40;</span><span style="color: #400080;">NSString</span> <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>filePath;
&nbsp;
<span style="color: #a61390;">@end</span></pre></td></tr></table></div>

<p>实现文件</p>

<div class="wp_codebox_msgheader wp_codebox_hide"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p392code17'); return false;">View Code</a> OBJC</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p39217"><td class="line_numbers"><pre>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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
</pre></td><td class="code" id="p392code17"><pre class="objc" style="font-family:monospace;"><span style="color: #6e371a;">#import &quot;EPUploader.h&quot;</span>
<span style="color: #6e371a;">#import </span>
&nbsp;
<span style="color: #a61390;">static</span> <span style="color: #400080;">NSString</span> <span style="color: #002200;">*</span> <span style="color: #a61390;">const</span> BOUNDRY <span style="color: #002200;">=</span> <span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;0xKhTmLbOuNdArY&quot;</span>;
<span style="color: #a61390;">static</span> <span style="color: #400080;">NSString</span> <span style="color: #002200;">*</span> <span style="color: #a61390;">const</span> FORM_FLE_INPUT <span style="color: #002200;">=</span> <span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;uploaded&quot;</span>;
&nbsp;
<span style="color: #6e371a;">#define ASSERT(x) NSAssert(x, @&quot;&quot;)</span>
&nbsp;
<span style="color: #a61390;">@interface</span> EPUploader <span style="color: #002200;">&#40;</span>Private<span style="color: #002200;">&#41;</span>
&nbsp;
<span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">void</span><span style="color: #002200;">&#41;</span>upload;
<span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #400080;">NSURLRequest</span> <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>postRequestWithURL<span style="color: #002200;">:</span> <span style="color: #002200;">&#40;</span><span style="color: #400080;">NSURL</span> <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>url
                             boundry<span style="color: #002200;">:</span> <span style="color: #002200;">&#40;</span><span style="color: #400080;">NSString</span> <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>boundry
                                data<span style="color: #002200;">:</span> <span style="color: #002200;">&#40;</span><span style="color: #400080;">NSData</span> <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>data;
<span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #400080;">NSData</span> <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>compress<span style="color: #002200;">:</span> <span style="color: #002200;">&#40;</span><span style="color: #400080;">NSData</span> <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>data;
<span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">void</span><span style="color: #002200;">&#41;</span>uploadSucceeded<span style="color: #002200;">:</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">BOOL</span><span style="color: #002200;">&#41;</span>success;
<span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">void</span><span style="color: #002200;">&#41;</span>connectionDidFinishLoading<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><span style="color: #400080;">NSURLConnection</span> <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>connection;
&nbsp;
<span style="color: #a61390;">@end</span>
&nbsp;
<span style="color: #a61390;">@implementation</span> EPUploader
&nbsp;
<span style="color: #11740a; font-style: italic;">/*
 *-----------------------------------------------------------------------------
 *
 * -[Uploader initWithURL:filePath:delegate:doneSelector:errorSelector:] --
 *
 *      Initializer. Kicks off the upload. Note that upload will happen on a
 *      separate thread.
 *
 * Results:
 *      An instance of Uploader.
 *
 * Side effects:
 *      None
 *
 *-----------------------------------------------------------------------------
 */</span>
&nbsp;
<span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">id</span><span style="color: #002200;">&#41;</span>initWithURL<span style="color: #002200;">:</span> <span style="color: #002200;">&#40;</span><span style="color: #400080;">NSURL</span> <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>aServerURL   <span style="color: #11740a; font-style: italic;">// IN</span>
         filePath<span style="color: #002200;">:</span> <span style="color: #002200;">&#40;</span><span style="color: #400080;">NSString</span> <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>aFilePath <span style="color: #11740a; font-style: italic;">// IN</span>
         delegate<span style="color: #002200;">:</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">id</span><span style="color: #002200;">&#41;</span>aDelegate         <span style="color: #11740a; font-style: italic;">// IN</span>
     doneSelector<span style="color: #002200;">:</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">SEL</span><span style="color: #002200;">&#41;</span>aDoneSelector    <span style="color: #11740a; font-style: italic;">// IN</span>
    errorSelector<span style="color: #002200;">:</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">SEL</span><span style="color: #002200;">&#41;</span>anErrorSelector  <span style="color: #11740a; font-style: italic;">// IN</span>
<span style="color: #002200;">&#123;</span>
    <span style="color: #a61390;">if</span> <span style="color: #002200;">&#40;</span><span style="color: #002200;">&#40;</span>self <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>super init<span style="color: #002200;">&#93;</span><span style="color: #002200;">&#41;</span><span style="color: #002200;">&#41;</span> <span style="color: #002200;">&#123;</span>
        ASSERT<span style="color: #002200;">&#40;</span>aServerURL<span style="color: #002200;">&#41;</span>;
        ASSERT<span style="color: #002200;">&#40;</span>aFilePath<span style="color: #002200;">&#41;</span>;
        ASSERT<span style="color: #002200;">&#40;</span>aDelegate<span style="color: #002200;">&#41;</span>;
        ASSERT<span style="color: #002200;">&#40;</span>aDoneSelector<span style="color: #002200;">&#41;</span>;
        ASSERT<span style="color: #002200;">&#40;</span>anErrorSelector<span style="color: #002200;">&#41;</span>;
&nbsp;
        serverURL <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>aServerURL retain<span style="color: #002200;">&#93;</span>;
        filePath <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>aFilePath retain<span style="color: #002200;">&#93;</span>;
        delegate <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>aDelegate retain<span style="color: #002200;">&#93;</span>;
        doneSelector <span style="color: #002200;">=</span> aDoneSelector;
        errorSelector <span style="color: #002200;">=</span> anErrorSelector;
&nbsp;
        <span style="color: #002200;">&#91;</span>self upload<span style="color: #002200;">&#93;</span>;
    <span style="color: #002200;">&#125;</span>
    <span style="color: #a61390;">return</span> self;
<span style="color: #002200;">&#125;</span>
&nbsp;
<span style="color: #11740a; font-style: italic;">/*
 *-----------------------------------------------------------------------------
 *
 * -[Uploader dealloc] --
 *
 *      Destructor.
 *
 * Results:
 *      None
 *
 * Side effects:
 *      None
 *
 *-----------------------------------------------------------------------------
 */</span>
&nbsp;
<span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">void</span><span style="color: #002200;">&#41;</span>dealloc
<span style="color: #002200;">&#123;</span>
    <span style="color: #002200;">&#91;</span>serverURL release<span style="color: #002200;">&#93;</span>;
    serverURL <span style="color: #002200;">=</span> <span style="color: #a61390;">nil</span>;
    <span style="color: #002200;">&#91;</span>filePath release<span style="color: #002200;">&#93;</span>;
    filePath <span style="color: #002200;">=</span> <span style="color: #a61390;">nil</span>;
    <span style="color: #002200;">&#91;</span>delegate release<span style="color: #002200;">&#93;</span>;
    delegate <span style="color: #002200;">=</span> <span style="color: #a61390;">nil</span>;
    doneSelector <span style="color: #002200;">=</span> <span style="color: #a61390;">NULL</span>;
    errorSelector <span style="color: #002200;">=</span> <span style="color: #a61390;">NULL</span>;
&nbsp;
    <span style="color: #002200;">&#91;</span>super dealloc<span style="color: #002200;">&#93;</span>;
<span style="color: #002200;">&#125;</span>
&nbsp;
<span style="color: #11740a; font-style: italic;">/*
 *-----------------------------------------------------------------------------
 *
 * -[Uploader filePath] --
 *
 *      Gets the path of the file this object is uploading.
 *
 * Results:
 *      Path to the upload file.
 *
 * Side effects:
 *      None
 *
 *-----------------------------------------------------------------------------
 */</span>
&nbsp;
<span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #400080;">NSString</span> <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>filePath
<span style="color: #002200;">&#123;</span>
    <span style="color: #a61390;">return</span> filePath;
<span style="color: #002200;">&#125;</span>
&nbsp;
<span style="color: #a61390;">@end</span> <span style="color: #11740a; font-style: italic;">// Uploader</span>
&nbsp;
<span style="color: #a61390;">@implementation</span> EPUploader <span style="color: #002200;">&#40;</span>Private<span style="color: #002200;">&#41;</span>
&nbsp;
<span style="color: #11740a; font-style: italic;">/*
 *-----------------------------------------------------------------------------
 *
 * -[Uploader(Private) upload] --
 *
 *      Uploads the given file. The file is compressed before beign uploaded.
 *      The data is uploaded using an HTTP POST command.
 *
 * Results:
 *      None
 *
 * Side effects:
 *      None
 *
 *-----------------------------------------------------------------------------
 */</span>
&nbsp;
<span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">void</span><span style="color: #002200;">&#41;</span>upload
<span style="color: #002200;">&#123;</span>
    <span style="color: #400080;">NSData</span> <span style="color: #002200;">*</span>data <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #400080;">NSData</span> dataWithContentsOfFile<span style="color: #002200;">:</span>filePath<span style="color: #002200;">&#93;</span>;
    ASSERT<span style="color: #002200;">&#40;</span>data<span style="color: #002200;">&#41;</span>;
    <span style="color: #a61390;">if</span> <span style="color: #002200;">&#40;</span><span style="color: #002200;">!</span>data<span style="color: #002200;">&#41;</span> <span style="color: #002200;">&#123;</span>
        <span style="color: #002200;">&#91;</span>self uploadSucceeded<span style="color: #002200;">:</span><span style="color: #a61390;">NO</span><span style="color: #002200;">&#93;</span>;
        <span style="color: #a61390;">return</span>;
    <span style="color: #002200;">&#125;</span>
    <span style="color: #a61390;">if</span> <span style="color: #002200;">&#40;</span><span style="color: #002200;">&#91;</span>data length<span style="color: #002200;">&#93;</span> <span style="color: #002200;">==</span> <span style="color: #2400d9;">0</span><span style="color: #002200;">&#41;</span> <span style="color: #002200;">&#123;</span>
        <span style="color: #11740a; font-style: italic;">// There's no data, treat this the same as no file.</span>
        <span style="color: #002200;">&#91;</span>self uploadSucceeded<span style="color: #002200;">:</span><span style="color: #a61390;">YES</span><span style="color: #002200;">&#93;</span>;
        <span style="color: #a61390;">return</span>;
    <span style="color: #002200;">&#125;</span>
&nbsp;
<span style="color: #11740a; font-style: italic;">//  NSData *compressedData = [self compress:data];</span>
<span style="color: #11740a; font-style: italic;">//  ASSERT(compressedData &amp;amp;&amp;amp; [compressedData length] != 0);</span>
<span style="color: #11740a; font-style: italic;">//  if (!compressedData || [compressedData length] == 0) {</span>
<span style="color: #11740a; font-style: italic;">//      [self uploadSucceeded:NO];</span>
<span style="color: #11740a; font-style: italic;">//      return;</span>
<span style="color: #11740a; font-style: italic;">//  }</span>
&nbsp;
    <span style="color: #400080;">NSURLRequest</span> <span style="color: #002200;">*</span>urlRequest <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>self postRequestWithURL<span style="color: #002200;">:</span>serverURL
                                                                                        boundry<span style="color: #002200;">:</span>BOUNDRY
                                                                                           data<span style="color: #002200;">:</span>data<span style="color: #002200;">&#93;</span>;
    <span style="color: #a61390;">if</span> <span style="color: #002200;">&#40;</span><span style="color: #002200;">!</span>urlRequest<span style="color: #002200;">&#41;</span> <span style="color: #002200;">&#123;</span>
        <span style="color: #002200;">&#91;</span>self uploadSucceeded<span style="color: #002200;">:</span><span style="color: #a61390;">NO</span><span style="color: #002200;">&#93;</span>;
        <span style="color: #a61390;">return</span>;
    <span style="color: #002200;">&#125;</span>
&nbsp;
    <span style="color: #400080;">NSURLConnection</span> <span style="color: #002200;">*</span> connection <span style="color: #002200;">=</span>
    <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span><span style="color: #400080;">NSURLConnection</span> alloc<span style="color: #002200;">&#93;</span> initWithRequest<span style="color: #002200;">:</span>urlRequest delegate<span style="color: #002200;">:</span>self<span style="color: #002200;">&#93;</span>;
    <span style="color: #a61390;">if</span> <span style="color: #002200;">&#40;</span><span style="color: #002200;">!</span>connection<span style="color: #002200;">&#41;</span> <span style="color: #002200;">&#123;</span>
        <span style="color: #002200;">&#91;</span>self uploadSucceeded<span style="color: #002200;">:</span><span style="color: #a61390;">NO</span><span style="color: #002200;">&#93;</span>;
    <span style="color: #002200;">&#125;</span>
&nbsp;
    <span style="color: #11740a; font-style: italic;">// Now wait for the URL connection to call us back.</span>
<span style="color: #002200;">&#125;</span>
&nbsp;
<span style="color: #11740a; font-style: italic;">/*
 *-----------------------------------------------------------------------------
 *
 * -[Uploader(Private) postRequestWithURL:boundry:data:] --
 *
 *      Creates a HTML POST request.
 *
 * Results:
 *      The HTML POST request.
 *
 * Side effects:
 *      None
 *
 *-----------------------------------------------------------------------------
 */</span>
&nbsp;
<span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #400080;">NSURLRequest</span> <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>postRequestWithURL<span style="color: #002200;">:</span> <span style="color: #002200;">&#40;</span><span style="color: #400080;">NSURL</span> <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>url        <span style="color: #11740a; font-style: italic;">// IN</span>
                             boundry<span style="color: #002200;">:</span> <span style="color: #002200;">&#40;</span><span style="color: #400080;">NSString</span> <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>boundry <span style="color: #11740a; font-style: italic;">// IN</span>
                                data<span style="color: #002200;">:</span> <span style="color: #002200;">&#40;</span><span style="color: #400080;">NSData</span> <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>data      <span style="color: #11740a; font-style: italic;">// IN</span>
<span style="color: #002200;">&#123;</span>
    <span style="color: #11740a; font-style: italic;">// from http://www.cocoadev.com/index.pl?HTTPFileUpload</span>
    <span style="color: #400080;">NSMutableURLRequest</span> <span style="color: #002200;">*</span>urlRequest <span style="color: #002200;">=</span>
    <span style="color: #002200;">&#91;</span><span style="color: #400080;">NSMutableURLRequest</span> requestWithURL<span style="color: #002200;">:</span>url<span style="color: #002200;">&#93;</span>;
    <span style="color: #002200;">&#91;</span>urlRequest setHTTPMethod<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;POST&quot;</span><span style="color: #002200;">&#93;</span>;
    <span style="color: #002200;">&#91;</span>urlRequest setValue<span style="color: #002200;">:</span>
     <span style="color: #002200;">&#91;</span><span style="color: #400080;">NSString</span> stringWithFormat<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;multipart/form-data; boundary=%@&quot;</span>, boundry<span style="color: #002200;">&#93;</span>
      forHTTPHeaderField<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;Content-Type&quot;</span><span style="color: #002200;">&#93;</span>;
&nbsp;
    <span style="color: #400080;">NSMutableData</span> <span style="color: #002200;">*</span>postData <span style="color: #002200;">=</span>
    <span style="color: #002200;">&#91;</span><span style="color: #400080;">NSMutableData</span> dataWithCapacity<span style="color: #002200;">:</span><span style="color: #002200;">&#91;</span>data length<span style="color: #002200;">&#93;</span> <span style="color: #002200;">+</span> 512<span style="color: #002200;">&#93;</span>;
    <span style="color: #002200;">&#91;</span>postData appendData<span style="color: #002200;">:</span>
     <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span><span style="color: #400080;">NSString</span> stringWithFormat<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;--%@<span style="color: #2400d9;">\r</span><span style="color: #2400d9;">\n</span>&quot;</span>, boundry<span style="color: #002200;">&#93;</span> dataUsingEncoding<span style="color: #002200;">:</span>NSUTF8StringEncoding<span style="color: #002200;">&#93;</span><span style="color: #002200;">&#93;</span>;
    <span style="color: #002200;">&#91;</span>postData appendData<span style="color: #002200;">:</span>
     <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span><span style="color: #400080;">NSString</span> stringWithFormat<span style="color: #002200;">:</span>
       <span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;Content-Disposition: form-data; name=<span style="color: #2400d9;">\&quot;</span>%@<span style="color: #2400d9;">\&quot;</span>; filename=<span style="color: #2400d9;">\&quot;</span>file.bin<span style="color: #2400d9;">\&quot;</span><span style="color: #2400d9;">\r</span><span style="color: #2400d9;">\n</span><span style="color: #2400d9;">\r</span><span style="color: #2400d9;">\n</span>&quot;</span>, FORM_FLE_INPUT<span style="color: #002200;">&#93;</span>
      dataUsingEncoding<span style="color: #002200;">:</span>NSUTF8StringEncoding<span style="color: #002200;">&#93;</span><span style="color: #002200;">&#93;</span>;
    <span style="color: #002200;">&#91;</span>postData appendData<span style="color: #002200;">:</span>data<span style="color: #002200;">&#93;</span>;
    <span style="color: #002200;">&#91;</span>postData appendData<span style="color: #002200;">:</span>
     <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span><span style="color: #400080;">NSString</span> stringWithFormat<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;<span style="color: #2400d9;">\r</span><span style="color: #2400d9;">\n</span>--%@--<span style="color: #2400d9;">\r</span><span style="color: #2400d9;">\n</span>&quot;</span>, boundry<span style="color: #002200;">&#93;</span> dataUsingEncoding<span style="color: #002200;">:</span>NSUTF8StringEncoding<span style="color: #002200;">&#93;</span><span style="color: #002200;">&#93;</span>;
&nbsp;
    <span style="color: #002200;">&#91;</span>urlRequest setHTTPBody<span style="color: #002200;">:</span>postData<span style="color: #002200;">&#93;</span>;
    <span style="color: #a61390;">return</span> urlRequest;
<span style="color: #002200;">&#125;</span>
&nbsp;
<span style="color: #11740a; font-style: italic;">/*
 *-----------------------------------------------------------------------------
 *
 * -[Uploader(Private) compress:] --
 *
 *      Uses zlib to compress the given data.
 *
 * Results:
 *      The compressed data as a NSData object.
 *
 * Side effects:
 *      None
 *
 *-----------------------------------------------------------------------------
 */</span>
&nbsp;
<span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #400080;">NSData</span> <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>compress<span style="color: #002200;">:</span> <span style="color: #002200;">&#40;</span><span style="color: #400080;">NSData</span> <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>data <span style="color: #11740a; font-style: italic;">// IN</span>
<span style="color: #002200;">&#123;</span>
    <span style="color: #a61390;">if</span> <span style="color: #002200;">&#40;</span><span style="color: #002200;">!</span>data || <span style="color: #002200;">&#91;</span>data length<span style="color: #002200;">&#93;</span> <span style="color: #002200;">==</span> 0<span style="color: #002200;">&#41;</span>
        <span style="color: #a61390;">return</span> <span style="color: #a61390;">nil</span>;
&nbsp;
    <span style="color: #11740a; font-style: italic;">// zlib compress doc says destSize must be 1% + 12 bytes greater than source.</span>
    uLong destSize <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>data length<span style="color: #002200;">&#93;</span> <span style="color: #002200;">*</span> 1.001 <span style="color: #002200;">+</span> <span style="color: #2400d9;">12</span>;
    <span style="color: #400080;">NSMutableData</span> <span style="color: #002200;">*</span>destData <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #400080;">NSMutableData</span> dataWithLength<span style="color: #002200;">:</span>destSize<span style="color: #002200;">&#93;</span>;
&nbsp;
    <span style="color: #a61390;">int</span> error <span style="color: #002200;">=</span> compress<span style="color: #002200;">&#40;</span><span style="color: #002200;">&#91;</span>destData mutableBytes<span style="color: #002200;">&#93;</span>,
                                         <span style="color: #002200;">&amp;</span>amp;destSize,
                                         <span style="color: #002200;">&#91;</span>data bytes<span style="color: #002200;">&#93;</span>,
                                         <span style="color: #002200;">&#91;</span>data length<span style="color: #002200;">&#93;</span><span style="color: #002200;">&#41;</span>;
    <span style="color: #a61390;">if</span> <span style="color: #002200;">&#40;</span>error <span style="color: #002200;">!=</span> Z_OK<span style="color: #002200;">&#41;</span> <span style="color: #002200;">&#123;</span>
        NSLog<span style="color: #002200;">&#40;</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;%s: self:0x%p, zlib error on compress:%d<span style="color: #2400d9;">\n</span>&quot;</span>,__func__, self, error<span style="color: #002200;">&#41;</span>;
        <span style="color: #a61390;">return</span> <span style="color: #a61390;">nil</span>;
    <span style="color: #002200;">&#125;</span>
&nbsp;
    <span style="color: #002200;">&#91;</span>destData setLength<span style="color: #002200;">:</span>destSize<span style="color: #002200;">&#93;</span>;
    <span style="color: #a61390;">return</span> destData;
<span style="color: #002200;">&#125;</span>
&nbsp;
<span style="color: #11740a; font-style: italic;">/*
 *-----------------------------------------------------------------------------
 *
 * -[Uploader(Private) uploadSucceeded:] --
 *
 *      Used to notify the delegate that the upload did or did not succeed.
 *
 * Results:
 *      None
 *
 * Side effects:
 *      None
 *
 *-----------------------------------------------------------------------------
 */</span>
&nbsp;
<span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">void</span><span style="color: #002200;">&#41;</span>uploadSucceeded<span style="color: #002200;">:</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">BOOL</span><span style="color: #002200;">&#41;</span>success <span style="color: #11740a; font-style: italic;">// IN</span>
<span style="color: #002200;">&#123;</span>
    <span style="color: #002200;">&#91;</span>delegate performSelector<span style="color: #002200;">:</span>success ? doneSelector <span style="color: #002200;">:</span> errorSelector
                           withObject<span style="color: #002200;">:</span>self<span style="color: #002200;">&#93;</span>;
<span style="color: #002200;">&#125;</span>
&nbsp;
<span style="color: #11740a; font-style: italic;">/*
 *-----------------------------------------------------------------------------
 *
 * -[Uploader(Private) connectionDidFinishLoading:] --
 *
 *      Called when the upload is complete. We judge the success of the upload
 *      based on the reply we get from the server.
 *
 * Results:
 *      None
 *
 * Side effects:
 *      None
 *
 *-----------------------------------------------------------------------------
 */</span>
&nbsp;
<span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">void</span><span style="color: #002200;">&#41;</span>connectionDidFinishLoading<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><span style="color: #400080;">NSURLConnection</span> <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>connection <span style="color: #11740a; font-style: italic;">// IN</span>
<span style="color: #002200;">&#123;</span>
    NSLog<span style="color: #002200;">&#40;</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;%s: self:0x%p<span style="color: #2400d9;">\n</span>&quot;</span>, __func__, self<span style="color: #002200;">&#41;</span>;
    <span style="color: #002200;">&#91;</span>connection release<span style="color: #002200;">&#93;</span>;
    <span style="color: #002200;">&#91;</span>self uploadSucceeded<span style="color: #002200;">:</span>uploadDidSucceed<span style="color: #002200;">&#93;</span>;
<span style="color: #002200;">&#125;</span>
&nbsp;
<span style="color: #11740a; font-style: italic;">/*
 *-----------------------------------------------------------------------------
 *
 * -[Uploader(Private) connection:didFailWithError:] --
 *
 *      Called when the upload failed (probably due to a lack of network
 *      connection).
 *
 * Results:
 *      None
 *
 * Side effects:
 *      None
 *
 *-----------------------------------------------------------------------------
 */</span>
&nbsp;
<span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">void</span><span style="color: #002200;">&#41;</span>connection<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><span style="color: #400080;">NSURLConnection</span> <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>connection <span style="color: #11740a; font-style: italic;">// IN</span>
  didFailWithError<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><span style="color: #400080;">NSError</span> <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>error              <span style="color: #11740a; font-style: italic;">// IN</span>
<span style="color: #002200;">&#123;</span>
    NSLog<span style="color: #002200;">&#40;</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;%s: self:0x%p, connection error:%s<span style="color: #2400d9;">\n</span>&quot;</span>,
                __func__, self, <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>error description<span style="color: #002200;">&#93;</span> UTF8String<span style="color: #002200;">&#93;</span><span style="color: #002200;">&#41;</span>;
    <span style="color: #002200;">&#91;</span>connection release<span style="color: #002200;">&#93;</span>;
    <span style="color: #002200;">&#91;</span>self uploadSucceeded<span style="color: #002200;">:</span><span style="color: #a61390;">NO</span><span style="color: #002200;">&#93;</span>;
<span style="color: #002200;">&#125;</span>
&nbsp;
<span style="color: #11740a; font-style: italic;">/*
 *-----------------------------------------------------------------------------
 *
 * -[Uploader(Private) connection:didReceiveResponse:] --
 *
 *      Called as we get responses from the server.
 *
 * Results:
 *      None
 *
 * Side effects:
 *      None
 *
 *-----------------------------------------------------------------------------
 */</span>
&nbsp;
<span style="color: #002200;">-</span><span style="color: #002200;">&#40;</span><span style="color: #a61390;">void</span><span style="color: #002200;">&#41;</span>       connection<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><span style="color: #400080;">NSURLConnection</span> <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>connection <span style="color: #11740a; font-style: italic;">// IN</span>
      didReceiveResponse<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><span style="color: #400080;">NSURLResponse</span> <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>response     <span style="color: #11740a; font-style: italic;">// IN</span>
<span style="color: #002200;">&#123;</span>
    NSLog<span style="color: #002200;">&#40;</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;%s: self:0x%p<span style="color: #2400d9;">\n</span>&quot;</span>, __func__, self<span style="color: #002200;">&#41;</span>;
<span style="color: #002200;">&#125;</span>
&nbsp;
<span style="color: #11740a; font-style: italic;">/*
 *-----------------------------------------------------------------------------
 *
 * -[Uploader(Private) connection:didReceiveData:] --
 *
 *      Called when we have data from the server. We expect the server to reply
 *      with a &quot;YES&quot; if the upload succeeded or &quot;NO&quot; if it did not.
 *
 * Results:
 *      None
 *
 * Side effects:
 *      None
 *
 *-----------------------------------------------------------------------------
 */</span>
&nbsp;
<span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">void</span><span style="color: #002200;">&#41;</span>connection<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><span style="color: #400080;">NSURLConnection</span> <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>connection <span style="color: #11740a; font-style: italic;">// IN</span>
    didReceiveData<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><span style="color: #400080;">NSData</span> <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>data                <span style="color: #11740a; font-style: italic;">// IN</span>
<span style="color: #002200;">&#123;</span>
    NSLog<span style="color: #002200;">&#40;</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;%s: self:0x%p<span style="color: #2400d9;">\n</span>&quot;</span>, __func__, self<span style="color: #002200;">&#41;</span>;
&nbsp;
    <span style="color: #400080;">NSString</span> <span style="color: #002200;">*</span>reply <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span><span style="color: #400080;">NSString</span> alloc<span style="color: #002200;">&#93;</span> initWithData<span style="color: #002200;">:</span>data
                                                                                 encoding<span style="color: #002200;">:</span>NSUTF8StringEncoding<span style="color: #002200;">&#93;</span>
                                   autorelease<span style="color: #002200;">&#93;</span>;
    NSLog<span style="color: #002200;">&#40;</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;%s: data: %s<span style="color: #2400d9;">\n</span>&quot;</span>, __func__, <span style="color: #002200;">&#91;</span>reply UTF8String<span style="color: #002200;">&#93;</span><span style="color: #002200;">&#41;</span>;
&nbsp;
    <span style="color: #a61390;">if</span> <span style="color: #002200;">&#40;</span><span style="color: #002200;">&#91;</span>reply hasPrefix<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;YES&quot;</span><span style="color: #002200;">&#93;</span><span style="color: #002200;">&#41;</span> <span style="color: #002200;">&#123;</span>
        uploadDidSucceed <span style="color: #002200;">=</span> <span style="color: #a61390;">YES</span>;
    <span style="color: #002200;">&#125;</span>
<span style="color: #002200;">&#125;</span>
&nbsp;
<span style="color: #a61390;">@end</span></pre></td></tr></table></div>

<p>使用方法</p>

<div class="wp_codebox_msgheader wp_codebox_hide"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p392code18'); return false;">View Code</a> OBJC</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p39218"><td class="line_numbers"><pre>1
2
3
4
5
6
</pre></td><td class="code" id="p392code18"><pre class="objc" style="font-family:monospace;"><span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>EPUploader alloc<span style="color: #002200;">&#93;</span> initWithURL<span style="color: #002200;">:</span><span style="color: #002200;">&#91;</span><span style="color: #400080;">NSURL</span> URLWithString<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;http://yourserver.com/uploadDB.php&quot;</span><span style="color: #002200;">&#93;</span>
		filePath<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;path/to/some/file&quot;</span>
		delegate<span style="color: #002200;">:</span>self
		doneSelector<span style="color: #002200;">:</span><span style="color: #a61390;">@selector</span><span style="color: #002200;">&#40;</span>onUploadDone<span style="color: #002200;">:</span><span style="color: #002200;">&#41;</span>
&nbsp;
		errorSelector<span style="color: #002200;">:</span><span style="color: #a61390;">@selector</span><span style="color: #002200;">&#40;</span>onUploadError<span style="color: #002200;">:</span><span style="color: #002200;">&#41;</span><span style="color: #002200;">&#93;</span>;</pre></td></tr></table></div>



<p>Related posts:<ol><li><a href='http://www.flyblog.info/catprogramming/335.html' rel='bookmark' title='Permanent Link: iPhone SDK 开发：如何判断WIFI链接'>iPhone SDK 开发：如何判断WIFI链接</a> <small>iPhone SDK提供了系统对话框用来判断是否有有效的WIFI链接， 这种情况已经在 iPhone SDK开发：如何显示WiFi提示 介绍过。 但是有时候如果打开了GPRS/Edge网络， 则不会弹出wifi对话框， 如果程序需要根据链接类型来传输不同的内容则需要判断当前有效链接是否为WIFI， 正好我的程序中用到就写了一个函数判断当前有效链接是否为WiFi...</small></li><li><a href='http://www.flyblog.info/catprogramming/409.html' rel='bookmark' title='Permanent Link: Create custom checkbox style button for iPhone'>Create custom checkbox style button for iPhone</a> <small>Recently, I got a task to develop an application for...</small></li><li><a href='http://www.flyblog.info/catprogramming/353.html' rel='bookmark' title='Permanent Link: iPhone SDK 开发: Facebook Connect应用'>iPhone SDK 开发: Facebook Connect应用</a> <small>如果你正在开发iPhone上的Facebook相关的应用软件，那么根据Facebook的相关使用协议，必须通过官方提供的api来进行访问， 否则会涉及倒版权问题。 Facebook的应用开发采用和google类似的Session Token的方式， 但比google 更复杂。 在用户登陆的过程中， Facebook强制用户交互操作已完成登陆，如果用户/密码验证成功，服务器会返回session key 和...</small></li></ol></p>
<p>Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.flyblog.info/catprogramming/392.html/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>
