<?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/"
xmlns:creativeCommons="http://backend.userland.com/creativeCommonsRssModule"
> <channel><title>F.A.B.L.E &#187; Cocoa</title> <atom:link href="http://sh3ng.com/category/dev/cocoa/feed/" rel="self" type="application/rss+xml" /><link>http://sh3ng.com</link> <description>iOS, Programming, Design, Game, Photography, Movie, Music, Trip, Sharing...</description> <lastBuildDate>Fri, 23 Sep 2011 03:04:36 +0000</lastBuildDate> <language>en</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.2.1</generator> <creativeCommons:license>http://creativecommons.org/licenses/by-nc-nd/3.0/</creativeCommons:license> <item><title>iOS Technical Note &amp; QA Collection</title><link>http://sh3ng.com/2011/08/ios-technical-note-qa-collection/</link> <comments>http://sh3ng.com/2011/08/ios-technical-note-qa-collection/#comments</comments> <pubDate>Sat, 06 Aug 2011 14:11:46 +0000</pubDate> <dc:creator>黑眼圈</dc:creator> <category><![CDATA[Cocoa]]></category> <category><![CDATA[Dev]]></category> <category><![CDATA[iOS]]></category> <guid
isPermaLink="false">http://sh3ng.com/?p=630</guid> <description><![CDATA[iOS Debugging Magic Understanding and Analyzing iPhone OS Application Crash Reports Troubleshooting Push Notifications Adding In App Purchase to your iOS and Mac Applications Getting a Packet Trace Document Transfer Strategies App Icons on iPad and iPhone Screen Capture in UIKit Applications Animating the frame of a CALayer CATiledLayer and UIKit graphics Improving Image Drawing [...]]]></description> <content:encoded><![CDATA[<p><a
href="http://developer.apple.com/library/ios/#technotes/tn2239/_index.html" target="_blank">iOS Debugging Magic</a> <br/><br/> <a
href="http://developer.apple.com/library/ios/#technotes/tn2151/_index.html#//apple_ref/doc/uid/DTS40008184" target="_blank">Understanding and Analyzing iPhone OS Application Crash Reports</a> <br/><br/> <a
href="http://developer.apple.com/library/ios/#technotes/tn2265/_index.html#//apple_ref/doc/uid/DTS40010376" target="_blank">Troubleshooting Push Notifications</a> <br/><br/> <a
href="http://developer.apple.com/library/ios/#technotes/tn2259/_index.html#//apple_ref/doc/uid/DTS40009578" target="_blank">Adding In App Purchase to your iOS and Mac Applications</a> <br/><br/> <a
href="http://developer.apple.com/library/mac/#qa/qa1176/_index.html" target="_blank">Getting a Packet Trace</a> <br/><br/> <a
href="http://developer.apple.com/library/ios/#technotes/tn2152/_index.html#//apple_ref/doc/uid/DTS40009179" target="_blank">Document Transfer Strategies</a> <br/><br/> <a
href="http://developer.apple.com/library/ios/#qa/qa1686/_index.html#//apple_ref/doc/uid/DTS40009882" target="_blank">App Icons on iPad and iPhone</a> <br/><br/> <a
href="http://developer.apple.com/library/ios/#qa/qa1703/_index.html#//apple_ref/doc/uid/DTS40010193" target="_blank">Screen Capture in UIKit Applications</a> <br/><br/> <a
href="http://developer.apple.com/library/ios/#qa/qa1620/_index.html#//apple_ref/doc/uid/DTS40008060" target="_blank">Animating the frame of a CALayer</a> <br/><br/> <a
href="http://developer.apple.com/library/ios/#qa/qa1637/_index.html#//apple_ref/doc/uid/DTS40009212" target="_blank">CATiledLayer and UIKit graphics</a> <br/><br/> <a
href="http://developer.apple.com/library/ios/#qa/qa1708/_index.html#//apple_ref/doc/uid/DTS40010245" target="_blank">Improving Image Drawing Performance on iOS</a> <br/><br/> <a
href="http://developer.apple.com/library/ios/#qa/qa1397/_index.html#//apple_ref/doc/uid/DTS40009877" target="_blank">Understanding the UIRequiredDeviceCapabilities key</a> <br/><br/> <a
href="http://developer.apple.com/library/ios/#qa/qa1699/_index.html#//apple_ref/doc/uid/DTS40010197" target="_blank">Storing Private Data</a> <br/><br/> <a
href="http://developer.apple.com/library/ios/#qa/qa1680/_index.html#//apple_ref/doc/uid/DTS40009452" target="_blank">Updating from a wildcard App ID to an explicit App ID</a> <br/><br/> <a
href="http://developer.apple.com/library/ios/#qa/qa1633/_index.html#//apple_ref/doc/uid/DTS40009414" target="_blank">Creating easy-to-read links to the App Store for your applications and company</a> <br/><br/> <a
href="http://developer.apple.com/library/ios/qa/qa1629/_index.html#//apple_ref/doc/uid/DTS40008173" target="_blank">Launching the App Store from an iPhone application</a></p> ]]></content:encoded> <wfw:commentRss>http://sh3ng.com/2011/08/ios-technical-note-qa-collection/feed/</wfw:commentRss> <slash:comments>0</slash:comments> <creativeCommons:license>http://creativecommons.org/licenses/by-nc-nd/3.0/</creativeCommons:license> </item> <item><title>iOS OpenSource Library Collection</title><link>http://sh3ng.com/2011/08/ios-opensource-library-collection/</link> <comments>http://sh3ng.com/2011/08/ios-opensource-library-collection/#comments</comments> <pubDate>Sat, 06 Aug 2011 09:31:36 +0000</pubDate> <dc:creator>黑眼圈</dc:creator> <category><![CDATA[Cocoa]]></category> <category><![CDATA[Dev]]></category> <category><![CDATA[iOS]]></category> <guid
isPermaLink="false">http://sh3ng.com/?p=616</guid> <description><![CDATA[UI MBProgressHUD MTStatusBarOverlay EGOTableViewPullRefresh EGOTextView PullToRefresh VerticalSwipeArticles SideSwipeTableView CustomTabBar TISwipeableTableView LightMenuBar JMTabView DCIntrospect Three20 Tapku Library CoreTextWrapper NSAttributedString Additions for HTML UIDickBar OpenFlow iBooks Flip Animation SVGKit Data JSON Framework JSONKit EGO Database FMDB MagicalRecord FBEncryptor Objective-C HMTL Parser ElementParser Hpple Hpple (I Add child nodes method) Internet ASIHTTPRequest OAuth Consumer Twitter OAuth MGTwitterEngine AWS [...]]]></description> <content:encoded><![CDATA[<h2>UI</h2><p><a
href="https://github.com/jdg/MBProgressHUD" target="_blank">MBProgressHUD</a></p><p><a
href="https://github.com/myell0w/MTStatusBarOverlay">MTStatusBarOverlay</a></p><p><a
href="https://github.com/enormego/EGOTableViewPullRefresh">EGOTableViewPullRefresh</a></p><p><a
href="https://github.com/enormego/EGOTextView">EGOTextView</a></p><p><a
href="https://github.com/leah/PullToRefresh">PullToRefresh</a></p><p><a
href="https://github.com/boctor/idev-recipes/tree/master/VerticalSwipeArticles">VerticalSwipeArticles</a></p><p><a
href="https://github.com/boctor/idev-recipes/tree/master/SideSwipeTableView">SideSwipeTableView</a></p><p><a
href="https://github.com/boctor/idev-recipes/tree/master/CustomTabBar">CustomTabBar</a></p><p><a
href="https://github.com/thermogl/TISwipeableTableView" target="_blank">TISwipeableTableView</a></p><p><a
href="https://github.com/pppoe/LightMenuBar">LightMenuBar</a></p><p><a
href="https://github.com/jasonmorrissey/JMTabView">JMTabView</a></p><p><a
href="https://github.com/domesticcatsoftware/DCIntrospect">DCIntrospect</a></p><p><a
href="http://three20.info/" target="_blank">Three20</a></p><p><a
href="https://github.com/devinross/tapkulibrary">Tapku Library</a></p><p><a
href="https://github.com/akosma/CoreTextWrapper">CoreTextWrapper</a></p><p><a
href="https://github.com/Cocoanetics/NSAttributedString-Additions-for-HTML" target="_blank">NSAttributedString Additions for HTML</a></p><p><a
href="https://github.com/digdog/UIDickBar">UIDickBar</a></p><p><a
href="https://github.com/thefaj/OpenFlow">OpenFlow</a></p><p><a
href="https://github.com/devindoty/iBooks-Flip-Animation">iBooks Flip Animation</a></p><p><a
href="https://github.com/mattrajca/SVGKit">SVGKit</a></p><h2>Data</h2><p><a
href="https://github.com/stig/json-framework" target="_blank">JSON Framework</a></p><p><a
href="https://github.com/johnezang/JSONKit">JSONKit</a></p><p><a
href="https://github.com/enormego/egodatabase" target="_blank">EGO Database</a></p><p><a
href="https://github.com/ccgus/fmdb" target="_blank">FMDB</a></p><p><a
href="https://github.com/magicalpanda/MagicalRecord">MagicalRecord</a></p><p><a
href="https://github.com/dev5tec/FBEncryptor">FBEncryptor</a></p><p><a
href="https://github.com/zootreeves/Objective-C-HMTL-Parser">Objective-C HMTL Parser</a></p><p><a
href="https://github.com/Objective3/ElementParser">ElementParser</a></p><p><a
href="https://github.com/topfunky/hpple">Hpple</a></p><p><a
href="https://github.com/doskoi/hpple">Hpple (I Add child nodes method)</a></p><h2>Internet</h2><p><a
href="http://allseeing-i.com/ASIHTTPRequest/" target="_blank">ASIHTTPRequest</a></p><p><a
href="https://github.com/jdg/oauthconsumer">OAuth Consumer</a></p><p><a
href="https://github.com/bengottlieb/Twitter-OAuth-iPhone" target="_blank">Twitter OAuth</a></p><p><a
href="https://github.com/mattgemmell/MGTwitterEngine" target="_blank">MGTwitterEngine</a></p><p><a
href="https://github.com/amazonwebservices/aws-sdk-for-ios">AWS SDK for iOS</a></p><p><a
href="http://www.omnigroup.com/company/developer">OmniGroup</a></p><p><a
href="https://github.com/futuretap/FTLocationSimulator">FTLocationSimulator</a></p><p><a
href="https://github.com/route-me/route-me">Rout Me</a></p><h2>Other</h2><p><a
href="https://github.com/kaler/CrashKit" target="_blank">CrashKit</a></p><p><a
href="http://www.getsharekit.com/" target="_blank">ShareKit</a></p><p><a
href="https://github.com/futuretap/InAppSettingsKit">InAppSettingsKit</a></p><p><a
href="https://github.com/runmad/GiftKit">GiftKit</a></p><p><a
href="https://github.com/mattgallagher/AudioStreamer">Audio Streamer</a></p><p><a
href="https://github.com/atebits/SimFinger">Sim Finger</a></p> ]]></content:encoded> <wfw:commentRss>http://sh3ng.com/2011/08/ios-opensource-library-collection/feed/</wfw:commentRss> <slash:comments>0</slash:comments> <creativeCommons:license>http://creativecommons.org/licenses/by-nc-nd/3.0/</creativeCommons:license> </item> <item><title>April</title><link>http://sh3ng.com/2011/04/april/</link> <comments>http://sh3ng.com/2011/04/april/#comments</comments> <pubDate>Tue, 26 Apr 2011 06:10:57 +0000</pubDate> <dc:creator>黑眼圈</dc:creator> <category><![CDATA[Cocoa]]></category> <category><![CDATA[iOS]]></category> <category><![CDATA[hpple]]></category> <category><![CDATA[html]]></category> <category><![CDATA[ios]]></category> <category><![CDATA[parse]]></category> <category><![CDATA[realm]]></category> <category><![CDATA[WoW]]></category> <guid
isPermaLink="false">http://sh3ng.com/?p=536</guid> <description><![CDATA[Finally, World of Warcraft Realm Status for Cataclysm released, There prase HTML via hpple use XPath, very cool staff for developer. But hpple has a huge performance question, It&#8217;s can&#8217;t directly use child element for query result . Have to query search again, If use it at a big table, will take long minutes for parsing. [...]]]></description> <content:encoded><![CDATA[<p>Finally, <a
title="World of Warcraft Realm Status for Cataclysm" href="http://itunes.apple.com/app/wow-realm-status-for-cataclysm/id324513810?mt=8" target="_blank">World of Warcraft Realm Status for Cataclysm</a> released,</p><p>There prase HTML via <a
href="https://github.com/topfunky/hpple" target="_blank">hpple</a> use XPath, very cool staff for developer.</p><p>But hpple has a huge performance question, It&#8217;s can&#8217;t directly use child element for query result . Have to query search again, If use it at a big table, will take long minutes for parsing.</p><p>I was made a hack, add child elements support for hpple, It&#8217;s save 95% time when parse a complex html, I will fork this on github soon.</p> ]]></content:encoded> <wfw:commentRss>http://sh3ng.com/2011/04/april/feed/</wfw:commentRss> <slash:comments>0</slash:comments> <creativeCommons:license>http://creativecommons.org/licenses/by-nc-nd/3.0/</creativeCommons:license> </item> <item><title>dSYM wtf</title><link>http://sh3ng.com/2010/04/dsym-wtf/</link> <comments>http://sh3ng.com/2010/04/dsym-wtf/#comments</comments> <pubDate>Fri, 23 Apr 2010 11:42:12 +0000</pubDate> <dc:creator>黑眼圈</dc:creator> <category><![CDATA[Cocoa]]></category> <category><![CDATA[dSYM]]></category> <category><![CDATA[xcode]]></category> <guid
isPermaLink="false">http://sh3ng.com/?p=439</guid> <description><![CDATA[在XCODE编译项目之后,会在app旁看见一个同名的dSYM文件. 他是一个编译的中转文件,简单说就是debug的symbols包含在这个文件中. 他有什么作用? 当release的版本 crash的时候,会有一个日志文件,包含出错的内存地址, 使用symbolicatecrash工具能够把日志和dSYM文件转换成可以阅读的log信息,也就是将内存地址,转换成程序里的函数或变量和所属于的文件名. 有一篇详细的blog讲了这个过程 http://www.anoshkin.net/blog/2008/09/09/iphone-crash-logs/ 将类似 Thread 0 Crashed: 0 libobjc.A.dylib 0x300c87ec 0x300bb000 + 55276 1 MobileLines 0&#215;00006434 0&#215;1000 + 21556 2 MobileLines 0x000064c2 0&#215;1000 + 21698 3 UIKit 0x30a740ac 0x30a54000 + 131244 的log信息转换成 Thread 0 Crashed: 0 libobjc.A.dylib 0x300c87ec objc_msgSend + 20 1 MobileLines 0&#215;00006434 -[BoardView setSelectedPiece:] (BoardView.m:321) 2 MobileLines 0x000064c2 [...]]]></description> <content:encoded><![CDATA[<p>在XCODE编译项目之后,会在app旁看见一个同名的dSYM文件.
他是一个编译的中转文件,简单说就是debug的symbols包含在这个文件中.</p><p>他有什么作用? 当release的版本 crash的时候,会有一个日志文件,包含出错的内存地址, 使用symbolicatecrash工具能够把日志和dSYM文件转换成可以阅读的log信息,也就是将内存地址,转换成程序里的函数或变量和所属于的文件名. <span
id="more-439"></span> 有一篇详细的blog讲了这个过程
http://www.anoshkin.net/blog/2008/09/09/iphone-crash-logs/</p><p>将类似</p><blockquote>Thread 0 Crashed:
0   libobjc.A.dylib           0x300c87ec 0x300bb000 + 55276
1   MobileLines               0&#215;00006434 0&#215;1000 + 21556
2   MobileLines               0x000064c2 0&#215;1000 + 21698
3   UIKit                     0x30a740ac 0x30a54000 + 131244</blockquote><p>的log信息转换成</p><blockquote>Thread 0 Crashed:
0   libobjc.A.dylib           0x300c87ec objc_msgSend + 20
1   MobileLines               0&#215;00006434 -[BoardView setSelectedPiece:] (BoardView.m:321)
2   MobileLines               0x000064c2 -[BoardView touchesBegan:withEvent:] (BoardView.m:349)
3   UIKit                     0x30a740ac -[UIWindow sendEvent:] + 264</blockquote><p>的有用信息.</p><p>工具symbolicatecrash隐藏在/Developer/Platforms/iPhoneOS.platform/Developer/Library/Xcode/Plug-ins/iPhoneRemoteDevice.xcodeplugin/Contents/Resources/symbolicatecrash</p><p>所以一般复制到/usr/local/bin/ 成为命令行直接调用</p><blockquote>$ sudo cp /Developer/Platforms/iPhoneOS.platform/Developer/Library/Xcode/Plug-ins/iPhoneRemoteDevice.xcodeplugin/Contents/Resources/symbolicatecrash /usr/local/bin/</blockquote><p>这个时候运行</p><blockquote>$ symbolicatecrash -h</blockquote><p>就能看见帮助信息了.</p><p>这个时候,问题又来了..每次编译后的dsym文件都要手动保存一次,很是麻烦.</p><p>于是有人写了一个脚本,自动在编译后保存该文件.
请参考:
http://www.cimgf.com/2009/12/23/automatically-save-the-dsym-files/</p><p>脚本我复制过来在下面</p><blockquote> #!/bin/sh
if [ "$BUILD_STYLE" == "Debug" ]; then
echo &#8220;Skipping debug&#8221;
exit 0;
fi
if [ "$EFFECTIVE_PLATFORM_NAME" == "-iphonesimulator" ]; then
echo &#8220;Skipping simulator build&#8221;
exit 0;
fi
SRC_PATH=${DWARF_DSYM_FOLDER_PATH}/${DWARF_DSYM_FILE_NAME}
RELATIVE_DEST_PATH=dSYM/${EXECUTABLE_NAME}.$(date +%Y%m%d%H%M%S).app.dSYM
DEST_PATH=${PROJECT_DIR}/${RELATIVE_DEST_PATH}
echo &#8220;moving ${SRC_PATH} to ${DEST_PATH}&#8221;
mv &#8220;${SRC_PATH}&#8221; &#8220;${DEST_PATH}&#8221;
if [ -f ".git/config" ]; then
git add &#8220;${RELATIVE_DEST_PATH}&#8221;
git commit -m &#8220;Added dSYM file for ${BUILD_STYLE} build&#8221; &#8220;${RELATIVE_DEST_PATH}&#8221;
fi</blockquote> ]]></content:encoded> <wfw:commentRss>http://sh3ng.com/2010/04/dsym-wtf/feed/</wfw:commentRss> <slash:comments>0</slash:comments> <creativeCommons:license>http://creativecommons.org/licenses/by-nc-nd/3.0/</creativeCommons:license> </item> <item><title>为你的应用添加In App Purchase</title><link>http://sh3ng.com/2009/10/practice-in-app-purchase/</link> <comments>http://sh3ng.com/2009/10/practice-in-app-purchase/#comments</comments> <pubDate>Sun, 18 Oct 2009 21:58:36 +0000</pubDate> <dc:creator>黑眼圈</dc:creator> <category><![CDATA[Cocoa]]></category> <category><![CDATA[app store]]></category> <category><![CDATA[in app purchase]]></category> <category><![CDATA[itunes]]></category> <category><![CDATA[storekit]]></category> <category><![CDATA[xcode]]></category> <guid
isPermaLink="false">http://doskoi.cn/?p=300</guid> <description><![CDATA[自从10月16日苹果发送给所有开发者的那一封信，通知了程序内购买将可用于免费应用，我认为这也宣告了LITE版的时代结束。 成千上万的免费版的软件或游戏，将作为限制了功能的完整版免费发售，如果用户觉得有意购买，可以直接解锁完整版的功能或购买附加内容。 本文讲阐述如何为你现有的应用或游戏添加程序内购买(In App Purchase)功能。 阅读前提：假设了你拥有一定的iPhone SDK开发基础，和App Store实践经验。 你的程序需要唯一的Bundle ID, 如果已经发布的程序使用了通配符，那么就不能直接添加该功能。如果拥有了唯一的ID，请在program portal中添加你的app id，允许程序使用内购买(Enable In App Purchase)。 在设计好你的程序内购买的功能以后，首先需要定义元数据。来到iTunes Connect，在Manage Your In App Purchases中为你的程序添加一个程序内购买的商品。 上面第一个部分是添加的内部信息。参考名称，ID，类型，和价格。以及各种本地化信息。 这里简单说一下类型的选择，其他信息，以及In App Purchase支持什么类型的商品请查看Getting Started with In App Purchase。 Non-consumable 默认类型，非消耗品，具有持久性，特点是一次性购买，可用在所有设备。例如解锁游戏的储存关卡功能。 Consumable 消耗品，用完或使用后消失，可多次购买，不能用在所有的设备，例如游戏中的血瓶或技能书。 Subscription 订阅，和消耗品一样，除了可以在设备之间共享。 创建购买流程 大致可以分为十个步骤： 验证App Store存取权限 这样做是因为，家长控制或一些公司的配置文件阻止了此功能，使用支付队列的查询功能canMakePayments来确定用户是否有权限购买，返回值YES代表可以购买/NO代表没有权限购买。 载入目录 载入储存在本地或者远程的商品目录。 获得商品本地化信息 程序向App Store发起查询请求获得目录中商品的本地化信息。： myPossibleProds = [NSSet setWithObjects: @”myProd1”, @”myProd2”, @”myProd3, nil]; [...]]]></description> <content:encoded><![CDATA[<p>自从10月16日苹果发送给所有开发者的那<a
href="https://developer.apple.com/iphone/appstore/inapppurchase.html">一封信</a>，通知了程序内购买将可用于免费应用，我认为这也宣告了LITE版的时代结束。</p><p>成千上万的免费版的软件或游戏，将作为限制了功能的完整版免费发售，如果用户觉得有意购买，可以直接解锁完整版的功能或购买附加内容。
本文讲阐述如何为你现有的应用或游戏添加程序内购买(In App Purchase)功能。</p><p>阅读前提：假设了你拥有一定的iPhone SDK开发基础，和App Store实践经验。 <span
id="more-300"></span> 你的程序需要唯一的Bundle ID, 如果已经发布的程序使用了通配符，那么就不能直接添加该功能。如果拥有了唯一的ID，请在program portal中添加你的app id，允许程序使用内购买(Enable In App Purchase)。</p><p>在设计好你的程序内购买的功能以后，首先需要定义元数据。来到<a
href="https://itunesconnect.apple.com">iTunes Connect</a>，在Manage Your In App Purchases中为你的程序添加一个程序内购买的商品。</p><p><a
href="http://doskoi.cn/wp-content/uploads/2009/10/add.png"><img
class="alignnone size-medium wp-image-310" title="add" src="http://doskoi.cn/wp-content/uploads/2009/10/add-300x254.png" alt="add" width="300" height="254" /></a></p><p>上面第一个部分是添加的内部信息。参考名称，ID，类型，和价格。以及各种本地化信息。
这里简单说一下类型的选择，其他信息，以及In App Purchase支持什么类型的商品请查看<a
href="http://developer.apple.com/iphone/news/pdf/in_app_purchase.pdf">Getting Started with In App Purchase</a>。</p><p>Non-consumable 默认类型，非消耗品，具有持久性，特点是一次性购买，可用在所有设备。例如解锁游戏的储存关卡功能。
Consumable 消耗品，用完或使用后消失，可多次购买，不能用在所有的设备，例如游戏中的血瓶或技能书。
Subscription 订阅，和消耗品一样，除了可以在设备之间共享。</p><p><strong>创建购买流程</strong> 大致可以分为十个步骤：</p><ol><li>验证App Store存取权限
这样做是因为，家长控制或一些公司的配置文件阻止了此功能，使用支付队列的查询功能canMakePayments来确定用户是否有权限购买，返回值YES代表可以购买/NO代表没有权限购买。</li><li>载入目录
载入储存在本地或者远程的商品目录。</li><li>获得商品本地化信息
程序向App Store发起查询请求获得目录中商品的本地化信息。： <code>myPossibleProds = [NSSet setWithObjects: @”myProd1”, @”myProd2”, @”myProd3, nil];
myProdRequest = [[SKProductsRequest alloc] initWithProductIdentifiers: myPossibleProds];
myProdRequest.delegate = myProductsRequestDelegate;
[myProdRequest start];</code> 程序接收来自App Store的回应： <code>-(void)productsRequest:(SKProductsRequest *)request didReceiveResponse:(SKProductsResponse *)response
response包含可能的信息
response.products //产品信息
response.invalidProductIdentifiers //错误的产品标示符</code> 错误的产品可能由下面的原因导致：<ul><li>商品未在 iTunes Connect中录入。</li><li>商品没有选择“Cleared for Sale”。</li><li>商品还没有传播到所有服务器。</li></ul></li><li>创建商品信息
前面的步骤获得了产品信息的数组用以呈现： <code>myAvailableProductsArray = response.products;
for (SKProduct* aProduct in myAvailableProductsArray) {
diplayTitle  = aProduct.localizedTitle;
displayDesc  = aProduct.localizedDescription;
displayPrice = aProduct.price;
}</code></li><li>呈现商品信息
在UI中显示前面获得的信息</li><li>请求支付 <code>myPayment = [SKPayment paymentForProductIdentifier: selectedProdID userInfo: nil]; </code> 或 <code>myPayment = [SKPayment paymentForProduct: selectedProduct userInfo: nil]; </code> 然后提交到队列 <code>defaultPaymentQueue = [SKPaymentQueue defaultQueue];
[defaultPaymentQueue addTransactionObserver: myObserver]; <del
datetime="2009-10-18T20:51:30+00:00">[defaultPaymentQueue addPayment: myPayment]; </del> [defaultPaymentQueue addPayment: myRequest]; </code> <code>- (void)paymentQueue:(SKPaymentQueue *)queue updatedTransactions:(NSArray *)transactions</code></li> <code> </code><li>验证支付的事务 <code>for(SKPaymentTransaction *aTransaction in transactions) {
switch (aTransaction.transactionState ) {</code> <code> // 商品进入购买流程
case SKPaymentTransactionStatePurchasing:
...
break; <strong> // 成功购买商品
case SKPaymentTransactionStatePurchased:
...
break;
// 已经购买过该商品
case SKPaymentTransactionStateRestored:
...
break; </strong> // 用户取消交易
case: SKPaymentTransactionStateFailed
...
break; </code> App Store的交易回执
aTransaction.transactionReceipt<ul><li>Used to validate e-commerce transaction</li><li>Cryptographically signed chunk of data</li><li>Contains information about the purchase</li><li>Can validate using Web-based API</li></ul> 收到交易回执以后可以传送到你的服务器处理该交易。
你的服务器可以向苹果发送交易验证信息。
苹果的交易验证地址：https://buy.itunes.apple.com/verifyReceipt
验证数据格式：{ receipt-data : &#8230;}
苹果的返回值如果是{ status : 0 } 那么交易是正确，如果返回任何其他值 { status : any_other_value } 交易就是不成立。
你的服务器收到苹果的验证成功信息以后，返回给应用程序类似于解锁功能等消息。</li><li>解锁内置物品火提供远程存取地址
需要注意的地方<ul><li>用户可能随时退出程序。</li><li>Store Kit 的交易队列是持久化的。</li><li>交易是持久化的。</li><li>验证存取。</li><li>移除交易。</li></ul> <code>[[SKPaymentQueue defaultQueue] finishTransaction: transaction];</code></li><li>储存购买
需要将非消耗的购买记录在服务器上，以供用户更换设备或删除程序以后重新安装时再次解锁功能。</li><li>提供物品恢复
前面的代码中，已经购买过该商品的处理就是直接解锁。 <code>defaultPaymentQueue = [SKPaymentQueue defaultQueue];
[defaultPaymentQueue restoreCompletedTransactions]; </code></li></ol><p><strong>测试沙盒环境</strong> 只供给测试用户，并且设备上才有效，不能使用模拟器测试。
可以为每个国家的商店添加测试帐号。
不能用来测试其他的iTunes Store特性。
需要为每个测试添加唯一的email地址，可以考虑使用+
payam+usa@example.com—测试美国的商品
payam+uk@example.com—测试英国的商品
payam+jp@example.com—测试日本的商品
测试步骤，需要在设备的设置菜单中iTunes Store登出原有帐户。
然后不要在设置菜单中登录测试帐号，而是直接打开需要测试的程序进行测试。
在这之前需要在iTunes Connect的Manage Users菜单中添加In App Purchase测试用户。</p><p><strong>财务报表</strong></p><ul><li>收入和应用程序同样的规则<ul><li>你获得总收入的70%。</li><li>支付日程，使用税，报表等全部都一样。</li></ul></li><li>报表<ul><li>一样的报表格式。</li><li>贩卖的标示符栏显示物品的产品ID。</li><li>所有者标示符栏显示程序的ID。</li></ul></li></ul><p>本文部分内容参考自<a
href="http://developer.apple.com/iphone/library/documentation/NetworkingInternet/Conceptual/StoreKitGuide/index.html">In App Purchase Programming Guide</a>和WWDC 2009 Sessions，如需转载请注明出处。</p> ]]></content:encoded> <wfw:commentRss>http://sh3ng.com/2009/10/practice-in-app-purchase/feed/</wfw:commentRss> <slash:comments>12</slash:comments> <creativeCommons:license>http://creativecommons.org/licenses/by-nc-nd/3.0/</creativeCommons:license> </item> <item><title>Xcode 3.2 引入代码静态分析</title><link>http://sh3ng.com/2009/09/xcode-with-static-code-analysis-via-clang/</link> <comments>http://sh3ng.com/2009/09/xcode-with-static-code-analysis-via-clang/#comments</comments> <pubDate>Fri, 11 Sep 2009 23:26:42 +0000</pubDate> <dc:creator>黑眼圈</dc:creator> <category><![CDATA[Cocoa]]></category> <category><![CDATA[clang]]></category> <category><![CDATA[xcode]]></category> <guid
isPermaLink="false">http://doskoi.cn/?p=243</guid> <description><![CDATA[Xcode 3.2引入了Clang的代码静态分析功能，在项目设置中替换默认编译器即可开启。 唯一的不足就是xcode 3.2只能安装在snow leopard，对于没有升级的开发者来说比较遗憾。 leopard最新的只有3.1.4，支持使用Instruments通过Wifi调试，据说3.2xcode支持wifi调试。(需要OS 3.1)]]></description> <content:encoded><![CDATA[<p>Xcode 3.2引入了<a
href="http://iPhoneDeveloperTips.com/xcode/static-code-analysis-clang-and-xcode-3-2.html">Clang的代码静态分析功能</a>，在项目设置中替换默认编译器即可开启。
唯一的不足就是xcode 3.2只能安装在snow leopard，对于没有升级的开发者来说比较遗憾。
leopard最新的只有3.1.4，支持使用Instruments通过Wifi调试，据说3.2xcode支持wifi调试。(需要OS 3.1)</p> ]]></content:encoded> <wfw:commentRss>http://sh3ng.com/2009/09/xcode-with-static-code-analysis-via-clang/feed/</wfw:commentRss> <slash:comments>0</slash:comments> <creativeCommons:license>http://creativecommons.org/licenses/by-nc-nd/3.0/</creativeCommons:license> </item> <item><title>How to select graphics engine on iPhone</title><link>http://sh3ng.com/2009/08/how-to-select-graphics-engine-on-iphone/</link> <comments>http://sh3ng.com/2009/08/how-to-select-graphics-engine-on-iphone/#comments</comments> <pubDate>Thu, 20 Aug 2009 02:09:01 +0000</pubDate> <dc:creator>黑眼圈</dc:creator> <category><![CDATA[Cocoa]]></category> <category><![CDATA[iPhone]]></category> <category><![CDATA[UI]]></category> <guid
isPermaLink="false">http://doskoi.cn/?p=215</guid> <description><![CDATA[Overview Architecture Usage]]></description> <content:encoded><![CDATA[<p>Overview <a
href="http://www.flickr.com/photos/doskoi/3837950485/" title="Flickr 上 Asuroa 的 Image 2"><img
src="http://farm3.static.flickr.com/2567/3837950485_d42b983cca.jpg" width="440"  alt="Image 2" /></a></p><p>Architecture <a
href="http://www.flickr.com/photos/doskoi/3838740562/" title="Flickr 上 Asuroa 的 Image 1"><img
src="http://farm4.static.flickr.com/3547/3838740562_56662fb354.jpg" width="440"  alt="Image 1" /></a></p><p>Usage <a
href="http://www.flickr.com/photos/doskoi/3838740062/" title="Flickr 上 Asuroa 的 Image 3"><img
src="http://farm4.static.flickr.com/3501/3838740062_68c7eb41a0.jpg" width="440"  alt="Image 3" /></a></p> ]]></content:encoded> <wfw:commentRss>http://sh3ng.com/2009/08/how-to-select-graphics-engine-on-iphone/feed/</wfw:commentRss> <slash:comments>0</slash:comments> <creativeCommons:license>http://creativecommons.org/licenses/by-nc-nd/3.0/</creativeCommons:license> </item> <item><title>What&#8217;s different on iphone device and simulator</title><link>http://sh3ng.com/2009/08/whats-different-on-iphone-device-and-simulator/</link> <comments>http://sh3ng.com/2009/08/whats-different-on-iphone-device-and-simulator/#comments</comments> <pubDate>Thu, 20 Aug 2009 01:50:17 +0000</pubDate> <dc:creator>黑眼圈</dc:creator> <category><![CDATA[Cocoa]]></category> <category><![CDATA[device]]></category> <category><![CDATA[iPhone]]></category> <category><![CDATA[simulator]]></category> <guid
isPermaLink="false">http://doskoi.cn/?p=209</guid> <description><![CDATA[Device vs. Simulator Taking advantage of the differences the code for detect if TARGET_IPHONE_SIMULATOR // Simulator-specific code else // iPhone-specific code end]]></description> <content:encoded><![CDATA[<p>Device vs. Simulator
Taking advantage of the differences</p><p>the code for detect</p><h1>if TARGET_IPHONE_SIMULATOR</h1><p>// Simulator-specific code</p><h1>else</h1><p>// iPhone-specific code</p><h1>end</h1><p><a
title="Flickr 上 Asuroa 的 Image 4" href="http://www.flickr.com/photos/doskoi/3838740216/"><img
src="http://farm3.static.flickr.com/2604/3838740216_046664a557.jpg" alt="Image 4" width="440" /></a></p> ]]></content:encoded> <wfw:commentRss>http://sh3ng.com/2009/08/whats-different-on-iphone-device-and-simulator/feed/</wfw:commentRss> <slash:comments>0</slash:comments> <creativeCommons:license>http://creativecommons.org/licenses/by-nc-nd/3.0/</creativeCommons:license> </item> </channel> </rss>
