<?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>Zero4Racer PRO Developer&#039;s Blog</title>
	<atom:link href="http://www.zero4racer.com/blog/feed" rel="self" type="application/rss+xml" />
	<link>http://www.zero4racer.com/blog</link>
	<description>iOS, Mac 技術情報サイト</description>
	<lastBuildDate>Thu, 17 May 2012 22:12:52 +0000</lastBuildDate>
	<language>ja</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Flipboard風のUIが実現出来るHMGLTransitionsが便利そう</title>
		<link>http://www.zero4racer.com/blog/657</link>
		<comments>http://www.zero4racer.com/blog/657#comments</comments>
		<pubDate>Thu, 17 May 2012 06:21:11 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Japanese]]></category>
		<category><![CDATA[Objective-C]]></category>
		<category><![CDATA[UIKit]]></category>

		<guid isPermaLink="false">http://www.zero4racer.com/blog/?p=657</guid>
		<description><![CDATA[TweetTweetOverviewのUIデザインは、横スクロールを採用しているのですが、どうも、もうちょっとうまいやり方は無いかなと考えていて、ページめくり的なものを導入したいなと考えています。 ちょうど今日、Flip [...]]]></description>
			<content:encoded><![CDATA[<div id="tweetbutton657" class="tw_button" style="float:right;margin-left:10px;"><a href="http://twitter.com/share?url=http%3A%2F%2Fwww.zero4racer.com%2Fblog%2F657&amp;via=tomohisa&amp;text=Flipboard%E9%A2%A8%E3%81%AEUI%E3%81%8C%E5%AE%9F%E7%8F%BE%E5%87%BA%E6%9D%A5%E3%82%8BHMGLTransitions%E3%81%8C%E4%BE%BF%E5%88%A9%E3%81%9D%E3%81%86%20-%20Zero4Racer%20PRO%20Developer%27s%20Blog&amp;related=tomohisa:iPhone+Developer+Tomohisa+Takaoka+at+J-Tech+Creations%2C+Inc.&amp;lang=en&amp;count=horizontal&amp;counturl=http%3A%2F%2Fwww.zero4racer.com%2Fblog%2F657" class="twitter-share-button"  style="width:55px;height:22px;background:transparent url('http://www.zero4racer.com/blog/wp-content/plugins/wp-tweet-button/tweetn.png') no-repeat  0 0;text-align:left;text-indent:-9999px;display:block;">Tweet</a></div><p>TweetOverviewのUIデザインは、横スクロールを採用しているのですが、どうも、もうちょっとうまいやり方は無いかなと考えていて、ページめくり的なものを導入したいなと考えています。<br />
ちょうど今日、Flipboardのコンテンツの日本語対応が行われたようで、やはり、FlipboardのUIは、使いやすいなと感じますね。<br />
<figure id="attachment_659" class="wp-caption aligncenter" style="width: 1024px"><a href="http://flipboard.com/"><img src="http://www.zero4racer.com/blog/wp-content/uploads/2012/05/Screen-Shot-2012-05-16-at-10.14.30-PM-1024x598.png" alt="http://flipboard.com/" title="http://flipboard.com/" width="1024" height="598" class="size-large wp-image-659" /></a><figcaption class="wp-caption-text">http://flipboard.com/</figcaption></figure></p>
<p><span id="more-657"></span><br />
これを実現する便利そうなクラスがこちら。<br />
<a href="https://github.com/Split82/HMGLTransitions">Split82/HMGLTransitions </a><br />
<figure id="attachment_660" class="wp-caption aligncenter" style="width: 300px"><a href="https://github.com/Split82/HMGLTransitions"><img src="http://www.zero4racer.com/blog/wp-content/uploads/2012/05/Screen-Shot-2012-05-16-at-10.17.18-PM-300x201.png" alt="https://github.com/Split82/HMGLTransitions" title="https://github.com/Split82/HMGLTransitions" width="300" height="201" class="size-medium wp-image-660" /></a><figcaption class="wp-caption-text">https://github.com/Split82/HMGLTransitions</figcaption></figure></p>
<p>これによって、Viewに対するトランジション、ViewControllerをModalで出現させるTransitionが出来るようです。<br />
<figure id="attachment_661" class="wp-caption aligncenter" style="width: 640px"><a href="http://www.zero4racer.com/blog/wp-content/uploads/2012/05/IMG_0449.png"><img src="http://www.zero4racer.com/blog/wp-content/uploads/2012/05/IMG_0449.png" alt="動作画面" title="動作画面" width="640" height="960" class="size-full wp-image-661" /></a><figcaption class="wp-caption-text">動作画面</figcaption></figure></p>
<p>ボタンを押すと&#8230;</p>
<figure id="attachment_662" class="wp-caption aligncenter" style="width: 640px"><a href="http://www.zero4racer.com/blog/wp-content/uploads/2012/05/IMG_0451.png"><img src="http://www.zero4racer.com/blog/wp-content/uploads/2012/05/IMG_0451.png" alt="Transition実行中" title="Transition実行中" width="640" height="960" class="size-full wp-image-662" /></a><figcaption class="wp-caption-text">Transition実行中</figcaption></figure>
<p>このようにぱらぱらめくられています。</p>
<p>説明はこの様になっています。</p>
<blockquote><p>HMGLTransitions is set of Objective C classes which can animate few UIKit transitions in iOS ( > 3.0). This is not enhancement of standard animations. This animation works differently. All transitions are presented in UIView with CAEAGLLayer using OpenGL, which gives you absolute freedom in creating almost any animation. You can start using only transitions already created. Right now this four transitions are available: Switch3DTransition, FlipTransition, RotateTransition and ClothTransition (more comming). To perform transition animation HMGLTransitionManager singleton object is used.</p></blockquote>
<p>（抄訳）</p>
<blockquote><p>HMGLTransitionsは、iOS3以上で動く、Viewのアニメーションを実現するObjective-Cクラスです。これは，通常のアニメーションの拡張機能ではありません。通常のアニメーションとは別に動作します。UIViewと、CAEAGLLayerで、OpenGLを使っていて、自由にアニメーションを作成出来る様になっています。既に作成されたトランジションを使用することが出来、４つのトランジションがデフォルトで組み込まれています。Switch3DTransition, FlipTransition, RotateTransition と ClothTransitionです。（さらに別のものも将来実装される予定です。）トランジションの管理は、シングルトンの、HMGLTransitionManagerを使用することが出来ます。
</p></blockquote>
<p>ということで、便利そうですね。gitHubを見ると、別の人から、cubeのTransitionなどもpull requestが来ているみたいです。少しこのコードを見て勉強したいと思います。</p>
<p>私も参加させていただいた、iOS5 プログラミングブックでは、ViewControllerのコンテナを作成出来る、Containerコントローラーに関する記述が、8章に書かれています。それを使って，controllerをうまく分けて表示するのもよいかもしれませんね。</p>
<p><iframe src="http://rcm-jp.amazon.co.jp/e/cm?lt1=_blank&#038;bc1=000000&#038;IS2=1&#038;bg1=FFFFFF&#038;fc1=000000&#038;lc1=0000FF&#038;t=zero4racer-22&#038;o=9&#038;p=8&#038;l=as4&#038;m=amazon&#038;f=ifr&#038;ref=ss_til&#038;asins=4844332228" style="width:120px;height:240px;" scrolling="no" marginwidth="0" marginheight="0" frameborder="0"></iframe></p>
<p>iOS5プログラミングブック、６月の発売へ向けて、絶賛予約中です。</p>
<div id="tweetbutton657" class="tw_button" style="float:right;margin-left:10px;"><a href="http://twitter.com/share?url=http%3A%2F%2Fwww.zero4racer.com%2Fblog%2F657&amp;via=tomohisa&amp;text=Flipboard%E9%A2%A8%E3%81%AEUI%E3%81%8C%E5%AE%9F%E7%8F%BE%E5%87%BA%E6%9D%A5%E3%82%8BHMGLTransitions%E3%81%8C%E4%BE%BF%E5%88%A9%E3%81%9D%E3%81%86%20-%20Zero4Racer%20PRO%20Developer%27s%20Blog&amp;related=tomohisa:iPhone+Developer+Tomohisa+Takaoka+at+J-Tech+Creations%2C+Inc.&amp;lang=en&amp;count=horizontal&amp;counturl=http%3A%2F%2Fwww.zero4racer.com%2Fblog%2F657" class="twitter-share-button"  style="width:55px;height:22px;background:transparent url('http://www.zero4racer.com/blog/wp-content/plugins/wp-tweet-button/tweetn.png') no-repeat  0 0;text-align:left;text-indent:-9999px;display:block;">Tweet</a></div>]]></content:encoded>
			<wfw:commentRss>http://www.zero4racer.com/blog/657/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>[UIKit]ViewDidLoad は一度しか呼ばれないと思っていました&#8230;</title>
		<link>http://www.zero4racer.com/blog/650</link>
		<comments>http://www.zero4racer.com/blog/650#comments</comments>
		<pubDate>Mon, 14 May 2012 20:40:18 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Japanese]]></category>
		<category><![CDATA[Objective-C]]></category>
		<category><![CDATA[UIKit]]></category>

		<guid isPermaLink="false">http://www.zero4racer.com/blog/?p=650</guid>
		<description><![CDATA[TweetTweetOverviewのクラッシュレポートを解析して、気がつきました。 これは、ViewControllerのViewDidLoadメソッドが複数回呼ばれている故のクラッシュでした。 TweetOvervi [...]]]></description>
			<content:encoded><![CDATA[<div id="tweetbutton650" class="tw_button" style="float:right;margin-left:10px;"><a href="http://twitter.com/share?url=http%3A%2F%2Fwww.zero4racer.com%2Fblog%2F650&amp;via=tomohisa&amp;text=%5BUIKit%5DViewDidLoad%20%E3%81%AF%E4%B8%80%E5%BA%A6%E3%81%97%E3%81%8B%E5%91%BC%E3%81%B0%E3%82%8C%E3%81%AA%E3%81%84%E3%81%A8%E6%80%9D%E3%81%A3%E3%81%A6%E3%81%84%E3%81%BE%E3%81%97%E3%81%9F%26%238230%3B%20-%20Zero4Racer%20PRO...%20&amp;related=tomohisa:iPhone+Developer+Tomohisa+Takaoka+at+J-Tech+Creations%2C+Inc.&amp;lang=en&amp;count=horizontal&amp;counturl=http%3A%2F%2Fwww.zero4racer.com%2Fblog%2F650" class="twitter-share-button"  style="width:55px;height:22px;background:transparent url('http://www.zero4racer.com/blog/wp-content/plugins/wp-tweet-button/tweetn.png') no-repeat  0 0;text-align:left;text-indent:-9999px;display:block;">Tweet</a></div><p>TweetOverviewのクラッシュレポートを解析して、気がつきました。</p>
<p><figure id="attachment_651" class="wp-caption aligncenter" style="width: 1024px"><a href="http://www.zero4racer.com/blog/wp-content/uploads/2012/05/Screen-Shot-2012-05-14-at-1.23.04-PM.png"><img src="http://www.zero4racer.com/blog/wp-content/uploads/2012/05/Screen-Shot-2012-05-14-at-1.23.04-PM-1024x787.png" alt="ViewDidLoadでのクラッシュ" title="ViewDidLoadでのクラッシュ" width="1024" height="787" class="size-large wp-image-651" /></a><figcaption class="wp-caption-text">ViewDidLoadでのクラッシュ</figcaption></figure><br />
これは、ViewControllerのViewDidLoadメソッドが複数回呼ばれている故のクラッシュでした。<br />
<span id="more-650"></span><br />
TweetOverviewでは、詳細画面から、メイン画面に戻るのですが、その際に、ViewDidLoadが再度呼ばれていました。といっても、Viewを再作成している訳ではなくて、[detailController dismissModalViewController...]から戻って来たときです。これは、どうも常識だったようですが、知りませんでした。。。昔のコード見直さないと。<br />
<a href="http://stackoverflow.com/questions/3949935/when-is-viewdidload-called">iphone &#8211; When is viewDidLoad called? &#8211; Stack Overflow </a>こちらを見ると、</p>
<blockquote><p><strong>You have to assume that viewDidLoad can be called multiple times. If there is a memory warning sent, your view controller will unload the view from memory, and the next time it is needed viewDidLoad will be called.</strong></p></blockquote>
<blockquote><p>viewDidloadは、複数回呼ばれる事を予測するべきです。メモリの警告が送られると、ViewControllerは、一度viewをメモリから解放して、次にviewが必要になる時に、再度viewDidLoadを呼ぶことになります</p></blockquote>
<p>との事です。つまり、view毎の状態を保存するなどのivarがある場合、viewDidLoad、viewDidUnloadなどでの、ivarの初期化、解放は危険だという事ですね。メモリの警告が発生される時に、バックグラウンドにあるビューがunloadされ、loadされる危険があります。はい、気をつけるとともに、昔のものを見直します。</p>
<h2>対策方法</h2>
<p>とはいえ、最初に表示される際のviewDidLoadは非常に便利なので、クラスのivarにdispatch_once_tで、一度だけ行うトークンを作成して、</p>
<div class="codecolorer-container objc mac-classic" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br /></div></td><td><div class="objc codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #a61390;">@implementation</span> ViewController<span style="color: #002200;">&#123;</span><br />
&nbsp; &nbsp; dispatch_once_t onceToken;<br />
<span style="color: #002200;">&#125;</span><br />
<span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">void</span><span style="color: #002200;">&#41;</span>viewDidLoad<br />
<span style="color: #002200;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #002200;">&#91;</span>super viewDidLoad<span style="color: #002200;">&#93;</span>;<br />
&nbsp; &nbsp; <span style="color: #11740a; font-style: italic;">// Do any additional setup after loading the view, typically from a nib.</span><br />
&nbsp; &nbsp; dispatch_once<span style="color: #002200;">&#40;</span><span style="color: #002200;">&amp;</span>onceToken, <span style="color: #002200;">^</span><span style="color: #002200;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; tweetViews <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>NSCache alloc<span style="color: #002200;">&#93;</span> init<span style="color: #002200;">&#93;</span>;<br />
&nbsp; &nbsp; <span style="color: #002200;">&#125;</span><span style="color: #002200;">&#41;</span>;<br />
<span style="color: #002200;">&#125;</span></div></td></tr></tbody></table></div>
<p>の用に記述して、初期化コードは、インスタンスに対して一度しか発生しない様に設定しました。</p>
<p>iOSのUIKitは、メモリ管理に関してもよく作られていますが、いろいろ注意点がありますね。</p>
<p><strong>2012/5/15追記しました。</strong></p>
<blockquote class="twitter-tweet" lang="ja"><p>viewDidUnloadで開放しないリソースの確保ならinit系かawakeFromNibで初期化すべきでは？ / “[UIKit]ViewDidLoad は一度しか呼ばれないと思っていました… | Zero4Racer PRO D…” <a href="http://t.co/BVrEArS1" title="http://htn.to/s5NvFb">htn.to/s5NvFb</a></p>
<p>&mdash; SAWA Tatsuhiroさん (@sawat1203) <a href="https://twitter.com/sawat1203/status/202204797221351425" data-datetime="2012-05-15T01:12:35+00:00">5月 15, 2012</a></p></blockquote>
<p><script src="//platform.twitter.com/widgets.js" charset="utf-8"></script><br />
これからは、AwakeFromNib使います。こちらにも詳しく書いています。<br />
<a href="http://stackoverflow.com/questions/377202/which-should-i-use-awakefromnib-or-viewdidload">cocoa touch &#8211; Which should I use, -awakeFromNib or -viewDidLoad? &#8211; Stack Overflow </a></p>
<blockquote><p>Also important is that the awakeFromNib function will never be called after recovering from memory warning. But, viewDidLoad function will be called.</p></blockquote>
<blockquote><p>AwakeFromNibは、メモリ警告から復帰した時に呼ばれないけど、viewDidLoadFunctionは、呼ばれます。</p></blockquote>
<p>描画に関係しない初期化は、AwakeFromNibが正解ですね。</p>
<div id="tweetbutton650" class="tw_button" style="float:right;margin-left:10px;"><a href="http://twitter.com/share?url=http%3A%2F%2Fwww.zero4racer.com%2Fblog%2F650&amp;via=tomohisa&amp;text=%5BUIKit%5DViewDidLoad%20%E3%81%AF%E4%B8%80%E5%BA%A6%E3%81%97%E3%81%8B%E5%91%BC%E3%81%B0%E3%82%8C%E3%81%AA%E3%81%84%E3%81%A8%E6%80%9D%E3%81%A3%E3%81%A6%E3%81%84%E3%81%BE%E3%81%97%E3%81%9F%26%238230%3B%20-%20Zero4Racer%20PRO...%20&amp;related=tomohisa:iPhone+Developer+Tomohisa+Takaoka+at+J-Tech+Creations%2C+Inc.&amp;lang=en&amp;count=horizontal&amp;counturl=http%3A%2F%2Fwww.zero4racer.com%2Fblog%2F650" class="twitter-share-button"  style="width:55px;height:22px;background:transparent url('http://www.zero4racer.com/blog/wp-content/plugins/wp-tweet-button/tweetn.png') no-repeat  0 0;text-align:left;text-indent:-9999px;display:block;">Tweet</a></div>]]></content:encoded>
			<wfw:commentRss>http://www.zero4racer.com/blog/650/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>UIWebView がクラッシュするのを防ぐ方法-3</title>
		<link>http://www.zero4racer.com/blog/642</link>
		<comments>http://www.zero4racer.com/blog/642#comments</comments>
		<pubDate>Sat, 12 May 2012 19:31:54 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Japanese]]></category>
		<category><![CDATA[Objective-C]]></category>
		<category><![CDATA[UIKit]]></category>
		<category><![CDATA[Xcode]]></category>

		<guid isPermaLink="false">http://www.zero4racer.com/blog/?p=642</guid>
		<description><![CDATA[Tweet追記2012/5/14 これでほぼクラッシュしない様になって来ているのですが、まだ、クラッシュすることがあります。最小構成を作成してみたところ、その構成では落ちないようです。メモリが少ない場合など、条件が重なっ [...]]]></description>
			<content:encoded><![CDATA[<div id="tweetbutton642" class="tw_button" style="float:right;margin-left:10px;"><a href="http://twitter.com/share?url=http%3A%2F%2Fwww.zero4racer.com%2Fblog%2F642&amp;via=tomohisa&amp;text=UIWebView%20%E3%81%8C%E3%82%AF%E3%83%A9%E3%83%83%E3%82%B7%E3%83%A5%E3%81%99%E3%82%8B%E3%81%AE%E3%82%92%E9%98%B2%E3%81%90%E6%96%B9%E6%B3%95-3%20-%20Zero4Racer%20PRO%20Developer%27s%20Blog&amp;related=tomohisa:iPhone+Developer+Tomohisa+Takaoka+at+J-Tech+Creations%2C+Inc.&amp;lang=en&amp;count=horizontal&amp;counturl=http%3A%2F%2Fwww.zero4racer.com%2Fblog%2F642" class="twitter-share-button"  style="width:55px;height:22px;background:transparent url('http://www.zero4racer.com/blog/wp-content/plugins/wp-tweet-button/tweetn.png') no-repeat  0 0;text-align:left;text-indent:-9999px;display:block;">Tweet</a></div><p><strong>追記2012/5/14 これでほぼクラッシュしない様になって来ているのですが、まだ、クラッシュすることがあります。最小構成を作成してみたところ、その構成では落ちないようです。メモリが少ない場合など、条件が重なって発生するようです。引き続き調査を続けます。</strong></p>
<p><a href="http://www.zero4racer.com/blog/628">UIWebView がクラッシュするのを防ぐ方法−２ | Zero4Racer PRO Developer&#8217;s Blog </a><br />
<a href="http://www.zero4racer.com/blog/565">iOS5 で UIWebView を使用しているときはご注意-予期せぬクラッシュを防ぐ方法 | Zero4Racer PRO Developer&#8217;s Blog </a><br />
の続編です。やはり、アプリが落ちることがありましたので、さらに修正してみました。</p>
<p><figure id="attachment_643" class="wp-caption aligncenter" style="width: 1024px"><a href="http://www.zero4racer.com/blog/wp-content/uploads/2012/05/Screen-Shot-2012-05-12-at-12.24.18-PM.png"><img src="http://www.zero4racer.com/blog/wp-content/uploads/2012/05/Screen-Shot-2012-05-12-at-12.24.18-PM-1024x473.png" alt="クラッシュの例" title="クラッシュの例" width="1024" height="473" class="size-large wp-image-643" /></a><figcaption class="wp-caption-text">クラッシュの例</figcaption></figure><br />
<span id="more-642"></span><br />
やはりStackOverflowで検索してみたところ、<br />
<a href="http://stackoverflow.com/questions/1264727/uiwebview-exc-bad-access-crash">iphone &#8211; UIWebView EXC_BAD_ACCESS crash &#8211; Stack Overflow </a><br />
この記事が見つかり、</p>
<blockquote><p>You have to stop loading the webView and remove the delegate before leaving the view:</p>
<div class="codecolorer-container objc mac-classic" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br /></div></td><td><div class="objc codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><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><br />
&nbsp; &nbsp; <span style="color: #002200;">&#91;</span>webView setDelegate<span style="color: #002200;">:</span><span style="color: #a61390;">nil</span><span style="color: #002200;">&#93;</span>;<br />
&nbsp; &nbsp; <span style="color: #002200;">&#91;</span>webView stopLoading<span style="color: #002200;">&#93;</span>;<br />
&nbsp; &nbsp; <span style="color: #002200;">&#91;</span>webView release<span style="color: #002200;">&#93;</span>;<br />
&nbsp; &nbsp; <span style="color: #002200;">&#91;</span>super dealloc<span style="color: #002200;">&#93;</span>;<br />
<span style="color: #002200;">&#125;</span></div></td></tr></tbody></table></div>
<p>What Apple documentation is saying: Important Before releasing an instance of UIWebView for which you have set a delegate, you must first set its delegate property to nil. This can be done, for example, in your dealloc method.</p></blockquote>
<p>とのことでした、よく自分のコードと比べてみると、delegate=nilと、[webview stopLoading];の順番が逆のようでした。どうも先にdelegate=nilをしないとだめなのかと思い、変更してみました。</p>
<p>また、</p>
<blockquote>
<p>0<br />
down vote<br />
I was having an EXC_BAD_ACCESS crash on a scrolling UIWebView, but only on the iPad, and only when the user had left the UIWebView scrolling when s/he closed the view controller containing it.</p>
<p>Setting the delegate to nil didn&#8217;t fix my problem here, but I found the solution elsewhere under a different issue. I added this code to the method called by my close button:</p>
<div class="codecolorer-container objc mac-classic" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br /></div></td><td><div class="objc codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #a61390;">for</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">id</span> subview <span style="color: #a61390;">in</span> webView.subviews<span style="color: #002200;">&#41;</span><span style="color: #002200;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #a61390;">if</span> <span style="color: #002200;">&#40;</span><span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>subview class<span style="color: #002200;">&#93;</span> isSubclassOfClass<span style="color: #002200;">:</span> <span style="color: #002200;">&#91;</span>UIScrollView class<span style="color: #002200;">&#93;</span><span style="color: #002200;">&#93;</span><span style="color: #002200;">&#41;</span><span style="color: #002200;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #002200;">&#91;</span>subview setContentOffset<span style="color: #002200;">:</span>CGPointZero animated<span style="color: #002200;">:</span><span style="color: #a61390;">NO</span><span style="color: #002200;">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #002200;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #002200;">&#125;</span></div></td></tr></tbody></table></div>
<p>This stops the scrolling before the dealloc method gets called, which seems to be the issue.
</p></blockquote>
<p>のコメントにもある様に、スクロールしている場合は、そのスクロールを止めてあげるといいかもしれませんとあるので、これも実行してみました。</p>
<p>今のところ、その後落ちてないようです。ただ、以前も１０回とか２０回に１回落ちる感じだったので、もしかしたらまた落ちるかもしれません。-4の記事を書く必要がなければよいですが。</p>
<div id="tweetbutton642" class="tw_button" style="float:right;margin-left:10px;"><a href="http://twitter.com/share?url=http%3A%2F%2Fwww.zero4racer.com%2Fblog%2F642&amp;via=tomohisa&amp;text=UIWebView%20%E3%81%8C%E3%82%AF%E3%83%A9%E3%83%83%E3%82%B7%E3%83%A5%E3%81%99%E3%82%8B%E3%81%AE%E3%82%92%E9%98%B2%E3%81%90%E6%96%B9%E6%B3%95-3%20-%20Zero4Racer%20PRO%20Developer%27s%20Blog&amp;related=tomohisa:iPhone+Developer+Tomohisa+Takaoka+at+J-Tech+Creations%2C+Inc.&amp;lang=en&amp;count=horizontal&amp;counturl=http%3A%2F%2Fwww.zero4racer.com%2Fblog%2F642" class="twitter-share-button"  style="width:55px;height:22px;background:transparent url('http://www.zero4racer.com/blog/wp-content/plugins/wp-tweet-button/tweetn.png') no-repeat  0 0;text-align:left;text-indent:-9999px;display:block;">Tweet</a></div>]]></content:encoded>
			<wfw:commentRss>http://www.zero4racer.com/blog/642/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>iOSアプリ内でステータスバーをオンオフする際に、Rootviewがずれない様にする方法</title>
		<link>http://www.zero4racer.com/blog/638</link>
		<comments>http://www.zero4racer.com/blog/638#comments</comments>
		<pubDate>Fri, 11 May 2012 21:28:17 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Japanese]]></category>
		<category><![CDATA[Objective-C]]></category>
		<category><![CDATA[UIKit]]></category>

		<guid isPermaLink="false">http://www.zero4racer.com/blog/?p=638</guid>
		<description><![CDATA[Tweetアプリ内の設定でステータスバーをオンオフすると、画面の位置がStatusバーとうまく合わなくて表示がおかしくなってしまうことがあります。 この対策方法です。 iphone &#8211; Hiding UISt [...]]]></description>
			<content:encoded><![CDATA[<div id="tweetbutton638" class="tw_button" style="float:right;margin-left:10px;"><a href="http://twitter.com/share?url=http%3A%2F%2Fwww.zero4racer.com%2Fblog%2F638&amp;via=tomohisa&amp;text=iOS%E3%82%A2%E3%83%97%E3%83%AA%E5%86%85%E3%81%A7%E3%82%B9%E3%83%86%E3%83%BC%E3%82%BF%E3%82%B9%E3%83%90%E3%83%BC%E3%82%92%E3%82%AA%E3%83%B3%E3%82%AA%E3%83%95%E3%81%99%E3%82%8B%E9%9A%9B%E3%81%AB%E3%80%81Rootview%E3%81%8C%E3%81%9A%E3%82%8C%E3%81%AA%E3%81%84%E6%A7%98%E3%81%AB%E3%81%99%E3%82%8B%E6%96%B9%E6%B3%95...%20&amp;related=tomohisa:iPhone+Developer+Tomohisa+Takaoka+at+J-Tech+Creations%2C+Inc.&amp;lang=en&amp;count=horizontal&amp;counturl=http%3A%2F%2Fwww.zero4racer.com%2Fblog%2F638" class="twitter-share-button"  style="width:55px;height:22px;background:transparent url('http://www.zero4racer.com/blog/wp-content/plugins/wp-tweet-button/tweetn.png') no-repeat  0 0;text-align:left;text-indent:-9999px;display:block;">Tweet</a></div><p>アプリ内の設定でステータスバーをオンオフすると、画面の位置がStatusバーとうまく合わなくて表示がおかしくなってしまうことがあります。<br />
<figure id="attachment_639" class="wp-caption aligncenter" style="width: 300px"><a href="http://www.zero4racer.com/blog/wp-content/uploads/2012/05/IMG_0062.png"><img src="http://www.zero4racer.com/blog/wp-content/uploads/2012/05/IMG_0062-300x225.png" alt="ステータスバーのオンオフによって、ビューの位置がおかしくなる" title="ステータスバーのオンオフによって、ビューの位置がおかしくなる" width="300" height="225" class="size-medium wp-image-639" /></a><figcaption class="wp-caption-text">ステータスバーのオンオフによって、ビューの位置がおかしくなる</figcaption></figure><br />
この対策方法です。<br />
<span id="more-638"></span><br />
<a href="http://stackoverflow.com/questions/6870489/hiding-uistatusbar-moving-uinavigationbar">iphone &#8211; Hiding UIStatusBar / Moving UINavigationBar &#8211; Stack Overflow </a>こちらのページが参考になりました。</p>
<div class="codecolorer-container objc mac-classic" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br /></div></td><td><div class="objc codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>UIApplication sharedApplication<span style="color: #002200;">&#93;</span> setStatusBarHidden<span style="color: #002200;">:!</span>TOVData.showStatus withAnimation<span style="color: #002200;">:</span>UIStatusBarAnimationNone<span style="color: #002200;">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; UIView<span style="color: #002200;">*</span> superview <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>self.navigationController.view superview<span style="color: #002200;">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #a61390;">int</span> index <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>superview.subviews indexOfObject<span style="color: #002200;">:</span>self.navigationController.view<span style="color: #002200;">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #002200;">&#91;</span>self.navigationController.view removeFromSuperview<span style="color: #002200;">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #002200;">&#91;</span>superview insertSubview<span style="color: #002200;">:</span>self.navigationController.view atIndex<span style="color: #002200;">:</span>index<span style="color: #002200;">&#93;</span>;</div></td></tr></tbody></table></div>
<p>このように、一度ビューをsuperviewから削除して、再登録すればうまくいきます。順番がずれないために、indexを取得して、insertしているのもポイントですね。</p>
<p>という事で、次のバージョンのTweetOverviewでは、statusバーを削除して、さらに表示面積を増やす設定を付けてみました（iPhone版も同時にユニバーサルでリリース予定）</p>
<div id="tweetbutton638" class="tw_button" style="float:right;margin-left:10px;"><a href="http://twitter.com/share?url=http%3A%2F%2Fwww.zero4racer.com%2Fblog%2F638&amp;via=tomohisa&amp;text=iOS%E3%82%A2%E3%83%97%E3%83%AA%E5%86%85%E3%81%A7%E3%82%B9%E3%83%86%E3%83%BC%E3%82%BF%E3%82%B9%E3%83%90%E3%83%BC%E3%82%92%E3%82%AA%E3%83%B3%E3%82%AA%E3%83%95%E3%81%99%E3%82%8B%E9%9A%9B%E3%81%AB%E3%80%81Rootview%E3%81%8C%E3%81%9A%E3%82%8C%E3%81%AA%E3%81%84%E6%A7%98%E3%81%AB%E3%81%99%E3%82%8B%E6%96%B9%E6%B3%95...%20&amp;related=tomohisa:iPhone+Developer+Tomohisa+Takaoka+at+J-Tech+Creations%2C+Inc.&amp;lang=en&amp;count=horizontal&amp;counturl=http%3A%2F%2Fwww.zero4racer.com%2Fblog%2F638" class="twitter-share-button"  style="width:55px;height:22px;background:transparent url('http://www.zero4racer.com/blog/wp-content/plugins/wp-tweet-button/tweetn.png') no-repeat  0 0;text-align:left;text-indent:-9999px;display:block;">Tweet</a></div>]]></content:encoded>
			<wfw:commentRss>http://www.zero4racer.com/blog/638/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>UIWebView がクラッシュするのを防ぐ方法−２</title>
		<link>http://www.zero4racer.com/blog/628</link>
		<comments>http://www.zero4racer.com/blog/628#comments</comments>
		<pubDate>Thu, 10 May 2012 07:56:02 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Objective-C]]></category>
		<category><![CDATA[UIKit]]></category>

		<guid isPermaLink="false">http://www.zero4racer.com/blog/?p=628</guid>
		<description><![CDATA[Tweet追記：2012/5/11 どうもこれでもクラッシュすることがあるようです。真の原因が分かったら、どなたか、教えてください&#8230; さらに追記しました：5/12 UIWebView がクラッシュするのを防ぐ [...]]]></description>
			<content:encoded><![CDATA[<div id="tweetbutton628" class="tw_button" style="float:right;margin-left:10px;"><a href="http://twitter.com/share?url=http%3A%2F%2Fwww.zero4racer.com%2Fblog%2F628&amp;via=tomohisa&amp;text=UIWebView%20%E3%81%8C%E3%82%AF%E3%83%A9%E3%83%83%E3%82%B7%E3%83%A5%E3%81%99%E3%82%8B%E3%81%AE%E3%82%92%E9%98%B2%E3%81%90%E6%96%B9%E6%B3%95%E2%88%92%EF%BC%92%20-%20Zero4Racer%20PRO%20Developer%27s%20Blog&amp;related=tomohisa:iPhone+Developer+Tomohisa+Takaoka+at+J-Tech+Creations%2C+Inc.&amp;lang=en&amp;count=horizontal&amp;counturl=http%3A%2F%2Fwww.zero4racer.com%2Fblog%2F628" class="twitter-share-button"  style="width:55px;height:22px;background:transparent url('http://www.zero4racer.com/blog/wp-content/plugins/wp-tweet-button/tweetn.png') no-repeat  0 0;text-align:left;text-indent:-9999px;display:block;">Tweet</a></div><p><strong>追記：2012/5/11 どうもこれでもクラッシュすることがあるようです。真の原因が分かったら、どなたか、教えてください&#8230;</strong><br />
<strong>さらに追記しました：5/12 <a href="http://www.zero4racer.com/blog/642">UIWebView がクラッシュするのを防ぐ方法-3 | Zero4Racer PRO Developer&#8217;s Blog </a><br />
</strong><br />
<a href="http://www.zero4racer.com/blog/565">iOS5 で UIWebView を使用しているときはご注意-予期せぬクラッシュを防ぐ方法 | Zero4Racer PRO Developer&#8217;s Blog </a>で基本的にとる方法として、delegateのリセット、removeFromSuperview、stopLoadingなどを上げたのですが、それでもうまくいきませんでした。理想的な方法ではないのですが、とりあえず落ちない（多分）ように修正したので報告しておきます。<br />
<figure id="attachment_629" class="wp-caption aligncenter" style="width: 225px"><a href="http://www.zero4racer.com/blog/wp-content/uploads/2012/05/IMG_00601.png"><img src="http://www.zero4racer.com/blog/wp-content/uploads/2012/05/IMG_00601-225x300.png" alt="WebViewの表示" title="WebViewの表示" width="225" height="300" class="size-medium wp-image-629" /></a><figcaption class="wp-caption-text">WebViewの表示</figcaption></figure><br />
<span id="more-628"></span><br />
落ちる典型のクラッシュログはこんな感じ</p>
<blockquote><p>Incident Identifier: 4D932A22-85F0-4ED7-AAD5-8B9D77207992<br />
CrashReporter Key:   92d191278ae2cc8971ec7375ba2d01242246f856<br />
Hardware Model:      iPad3,3<br />
Process:         TwitOverview [11240]<br />
Path:            /var/mobile/Applications/255B8BDB-8B16-4171-84D5-9F7DEC081A43/TwitOverview.app/TwitOverview<br />
Identifier:      TwitOverview<br />
Version:         ??? (???)<br />
Code Type:       ARM (Native)<br />
Parent Process:  launchd [1]</p>
<p>Date/Time:       2012-05-03 15:30:35.606 -0700<br />
OS Version:      iPhone OS 5.1 (9B176)<br />
Report Version:  104</p>
<p>Exception Type:  EXC_BAD_ACCESS (SIGSEGV)<br />
Exception Codes: KERN_INVALID_ADDRESS at 0&#215;00000000<br />
Crashed Thread:  3</p>
<p><strong><br />
Thread 3 name:  WebThread<br />
Thread 3 Crashed:<br />
0   libicucore.A.dylib            	0x346f868c 0&#215;34689000 + 456332<br />
1   libicucore.A.dylib            	0x34690f8c utext_setNativeIndex + 84<br />
2   libicucore.A.dylib            	0x34690f2e icu::RuleBasedBreakIterator::first() + 30<br />
3   libicucore.A.dylib            	0x34690e7c icu::RuleBasedBreakIterator::setText(UText*, UErrorCode&#038;) + 116<br />
4   libicucore.A.dylib            	0x34690df8 ubrk_setText + 72<br />
5   WebCore                       	0x332d4de4 WebCore::characterBreakIterator(unsigned short const*, int) + 84<br />
6   WebKit                        	0x3248974a -[NSString(WebStringDrawing) __web_drawInRect:withFont:ellipsis:alignment:letterSpacing:lineSpacing:includeEmoji:truncationRect:measureOnly:renderedStringOut:drawUnderline:] + 1182<br />
7   WebKit                        	0&#215;32402078 -[NSString(WebStringDrawing) __web_drawInRect:withFont:ellipsis:alignment:letterSpacing:lineSpacing:includeEmoji:truncationRect:measureOnly:renderedStringOut:] + 108<br />
8   WebKit                        	0x32401ffc -[NSString(WebStringDrawing) __web_drawInRect:withFont:ellipsis:alignment:letterSpacing:lineSpacing:includeEmoji:truncationRect:measureOnly:] + 100<br />
9   WebKit                        	0x32401f88 -[NSString(WebStringDrawing) _web_drawInRect:withFont:ellipsis:alignment:lineSpacing:includeEmoji:truncationRect:measureOnly:] + 100<br />
10  WebKit                        	0x32401f14 -[NSString(WebStringDrawing) _web_sizeInRect:withFont:ellipsis:lineSpacing:] + 80<br />
11  UIKit                         	0x325cc804 -[NSString(UIStringDrawing) sizeWithFont:constrainedToSize:lineBreakMode:lineSpacing:] + 108<br />
12  UIKit                         	0x32740f92 -[NSString(UIStringDrawing) sizeWithFont:constrainedToSize:lineBreakMode:] + 46<br />
13  TwitOverview                  	0x000fe590 +[TOVTweetView calcApproxHeightWithWidth:tweetData:] (TOVTweetView.m:74)<br />
14  TwitOverview                  	0x000fecb4 -[TOVTweetView layoutSubviews] (TOVTweetView.m:115)<br />
15  UIKit                         	0x325a80d8 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 176<br />
16  CoreFoundation                	0x3197a1f4 -[NSObject performSelector:withObject:] + 36<br />
17  QuartzCore                    	0x309f1a9e -[CALayer layoutSublayers] + 210<br />
18  QuartzCore                    	0x309f16b6 CA::Layer::layout_if_needed(CA::Transaction*) + 210<br />
19  QuartzCore                    	0x309f583c CA::Context::commit_transaction(CA::Transaction*) + 220<br />
20  QuartzCore                    	0x309f5578 CA::Transaction::commit() + 308<br />
21  QuartzCore                    	0x309ed4b2 CA::Transaction::observer_callback(__CFRunLoopObserver*, unsigned long, void*) + 50<br />
22  CoreFoundation                	0x319efb14 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 12<br />
23  CoreFoundation                	0x319edd50 __CFRunLoopDoObservers + 252<br />
24  CoreFoundation                	0x319ee0aa __CFRunLoopRun + 754<br />
25  CoreFoundation                	0x3197149e CFRunLoopRunSpecific + 294<br />
26  CoreFoundation                	0&#215;31971366 CFRunLoopRunInMode + 98<br />
27  WebCore                       	0x332850f0 _ZL12RunWebThreadPv + 396<br />
28  libsystem_c.dylib             	0x3114072e _pthread_start + 314<br />
29  libsystem_c.dylib             	0x311405e8 thread_start + 0<br />
</strong>
</p></blockquote>
<p>落ちたスレッドだけ強調表示していますが、どうも表示を終わらせて、ビューが消えているのにもかかわらず、表示しようとしているために起きているよう。理論的には</p>
<div class="codecolorer-container objc mac-classic" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br /></div></td><td><div class="objc codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">webView.delegate<span style="color: #002200;">=</span><span style="color: #a61390;">nil</span>; <br />
<span style="color: #002200;">&#91;</span>webView stopLoading<span style="color: #002200;">&#93;</span>;<br />
<span style="color: #002200;">&#91;</span>webView removeFromSuperview<span style="color: #002200;">&#93;</span>;</div></td></tr></tbody></table></div>
<p>で良さそうなのですが、それではうまくいきませんでした。それでとった方法は、<br />
<strong>WebViewを持っているviewControllerを再利用し、複数回使用する時に毎回生成しない</strong><br />
という方法です。<br />
<br />
通常は、StoryBoardで、segueを使っていたため、ViewControllerは、Segueで自動作成、自動解放されていたのですが、これを、古典的な、</p>
<div class="codecolorer-container objc mac-classic" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="objc codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp; &nbsp; <span style="color: #002200;">&#91;</span>self presentModalViewController<span style="color: #002200;">:</span>detail animated<span style="color: #002200;">:</span><span style="color: #a61390;">NO</span><span style="color: #002200;">&#93;</span>;</div></td></tr></tbody></table></div>
<p>に変更して、UIStoryboardから、viewControllerを生成</p>
<div class="codecolorer-container text mac-classic" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp; if (!detail) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; UIStoryboard *story=[UIStoryboard storyboardWithName:@&quot;MainStoryboard&quot; bundle:nil];<br />
&nbsp; &nbsp; &nbsp; &nbsp; detail = [story instantiateViewControllerWithIdentifier:@&quot;TOVTweetDetailViewController&quot;];<br />
&nbsp; }<br />
　[self presentModalViewController:detail animated:NO];</div></td></tr></tbody></table></div>
<p>これで、detailは、いつ度作成されたものが使い回されます。再利用するために，描画の初期化関係を少し調整。<br />
これで、今のところUIWebView周りで落ちない様になっているみたいです。</p>
<p>StoryBoardについては、来月発売iOS5プログラミングブックで、詳しく解説されています！この部分は、藤川さん <a href="https://twitter.com/#!/cqa02303">Hiroyuki-Fujikawa.HD (cqa02303) on Twitter</a> 担当！凄くいいです。<br />
<iframe src="http://rcm-jp.amazon.co.jp/e/cm?lt1=_blank&#038;bc1=000000&#038;IS2=1&#038;bg1=FFFFFF&#038;fc1=000000&#038;lc1=0000FF&#038;t=zero4racer-22&#038;o=9&#038;p=8&#038;l=as4&#038;m=amazon&#038;f=ifr&#038;ref=ss_til&#038;asins=4844332228" style="width:120px;height:240px;" scrolling="no" marginwidth="0" marginheight="0" frameborder="0"></iframe></p>
<p>クラッシュ対策、うまくいくといいですが。。。</p>
<div id="tweetbutton628" class="tw_button" style="float:right;margin-left:10px;"><a href="http://twitter.com/share?url=http%3A%2F%2Fwww.zero4racer.com%2Fblog%2F628&amp;via=tomohisa&amp;text=UIWebView%20%E3%81%8C%E3%82%AF%E3%83%A9%E3%83%83%E3%82%B7%E3%83%A5%E3%81%99%E3%82%8B%E3%81%AE%E3%82%92%E9%98%B2%E3%81%90%E6%96%B9%E6%B3%95%E2%88%92%EF%BC%92%20-%20Zero4Racer%20PRO%20Developer%27s%20Blog&amp;related=tomohisa:iPhone+Developer+Tomohisa+Takaoka+at+J-Tech+Creations%2C+Inc.&amp;lang=en&amp;count=horizontal&amp;counturl=http%3A%2F%2Fwww.zero4racer.com%2Fblog%2F628" class="twitter-share-button"  style="width:55px;height:22px;background:transparent url('http://www.zero4racer.com/blog/wp-content/plugins/wp-tweet-button/tweetn.png') no-repeat  0 0;text-align:left;text-indent:-9999px;display:block;">Tweet</a></div>]]></content:encoded>
			<wfw:commentRss>http://www.zero4racer.com/blog/628/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Pocket連携、検索ストリーム、ハッシュタグツイートなどの入った、TweetOverview 1.0.1 がリリース！</title>
		<link>http://www.zero4racer.com/blog/619</link>
		<comments>http://www.zero4racer.com/blog/619#comments</comments>
		<pubDate>Thu, 10 May 2012 01:30:41 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Promotions]]></category>
		<category><![CDATA[TweetOverview]]></category>

		<guid isPermaLink="false">http://www.zero4racer.com/blog/?p=619</guid>
		<description><![CDATA[TweetTweetOverview 1.0.1 が無事リリースされました。 TweetOverview TL一望デスクサイドアプリ (Version 1.0.1) カテゴリ: ソーシャルネットワーキング 価格: 無料  [...]]]></description>
			<content:encoded><![CDATA[<div id="tweetbutton619" class="tw_button" style="float:right;margin-left:10px;"><a href="http://twitter.com/share?url=http%3A%2F%2Fwww.zero4racer.com%2Fblog%2F619&amp;via=tomohisa&amp;text=Pocket%E9%80%A3%E6%90%BA%E3%80%81%E6%A4%9C%E7%B4%A2%E3%82%B9%E3%83%88%E3%83%AA%E3%83%BC%E3%83%A0%E3%80%81%E3%83%8F%E3%83%83%E3%82%B7%E3%83%A5%E3%82%BF%E3%82%B0%E3%83%84%E3%82%A4%E3%83%BC%E3%83%88%E3%81%AA%E3%81%A9%E3%81%AE%E5%85%A5%E3%81%A3%E3%81%9F%E3%80%81TweetOverview...%20&amp;related=tomohisa:iPhone+Developer+Tomohisa+Takaoka+at+J-Tech+Creations%2C+Inc.&amp;lang=en&amp;count=horizontal&amp;counturl=http%3A%2F%2Fwww.zero4racer.com%2Fblog%2F619" class="twitter-share-button"  style="width:55px;height:22px;background:transparent url('http://www.zero4racer.com/blog/wp-content/plugins/wp-tweet-button/tweetn.png') no-repeat  0 0;text-align:left;text-indent:-9999px;display:block;">Tweet</a></div><p>TweetOverview 1.0.1 が無事リリースされました。</p>
<table border="0" style="line-height: 1.2em;">
<tr>
<td rowspan="9" width="75px" style="padding: 0; vertical-align: top; border:0px;"><a href="http://click.linksynergy.com/fs-bin/click?id=umRNw*tA5oc&#038;subid=0&#038;offerid=94348.1&#038;type=10&#038;tmpid=3910&#038;RD_PARM0=http%3A%2F%2Fitunes.apple.com%2Fjp%2Fapp%2Ftweetoverview-tl-yi-wangdesukusaidoapuri%2Fid512174889%3Fmt%3D8%2526uo%3D4&#038;RD_PARM1=http%3A%2F%2Fitunes.apple.com%2Fjp%2Fapp%2Ftweetoverview-tl-yi-wangdesukusaidoapuri%2Fid512174889%3Fmt%3D8%2526uo%3D4" rel="nofollow" target="_blank"><img src="http://a5.mzstatic.com/us/r1000/091/Purple/v4/e4/11/eb/e411eb28-695d-fdde-a9e6-7c483ba1f83b/Icon.png" width="75" /></a></td>
<td colspan="2"><a href="http://click.linksynergy.com/fs-bin/click?id=umRNw*tA5oc&#038;subid=0&#038;offerid=94348.1&#038;type=10&#038;tmpid=3910&#038;RD_PARM0=http%3A%2F%2Fitunes.apple.com%2Fjp%2Fapp%2Ftweetoverview-tl-yi-wangdesukusaidoapuri%2Fid512174889%3Fmt%3D8%2526uo%3D4&#038;RD_PARM1=http%3A%2F%2Fitunes.apple.com%2Fjp%2Fapp%2Ftweetoverview-tl-yi-wangdesukusaidoapuri%2Fid512174889%3Fmt%3D8%2526uo%3D4" rel="nofollow" target="_blank"><strong>TweetOverview TL一望デスクサイドアプリ</strong> <small>(Version 1.0.1)</small> <img alt="App" src="http://ax.phobos.apple.com.edgesuite.net/ja_jp/images/web/linkmaker/badge_appstore-sm.gif" style="vertical-align: text-bottom;" /></a></td>
</tr>
<tr>
<td width="120px">カテゴリ:</td>
<td>ソーシャルネットワーキング</td>
</tr>
<tr>
<td>価格:</td>
<td>無料</td>
</tr>
<tr>
<td>デベロッパ名:</td>
<td>J-Tech Creations, Inc.</td>
</tr>
<tr>
<td>リリース日:</td>
<td>2012/04/23</td>
</tr>
<tr>
<td>対応デバイス:</td>
<td>iPad Wi-Fi+3G / iPad 2 Wi-Fi+3G / iPad Wi-Fi / iPad 2 Wi-Fi</td>
</tr>
<tr>
<td>現Ver.の平均評価:</td>
<td> (無し /  0件の評価)</td>
</tr>
<tr>
<td>通算の平均評価:</td>
<td><img src="http://r.mzstatic.com/htmlResources/5176/images/rating_star.png" height="11px" width="11px" /><img src="http://r.mzstatic.com/htmlResources/5176/images/rating_star.png" height="11px" width="11px" /><img src="http://r.mzstatic.com/htmlResources/5176/images/rating_star.png" height="11px" width="11px" /><img src="http://r.mzstatic.com/htmlResources/5176/images/rating_star_half.png" height="11px" width="11px" /> (3.5 / 3件の評価)</td>
</tr>
<tr>
<td>Game Center:</td>
<td>非対応</td>
</tr>
</table>
<div align="center" style="margin: 5px;"><a href="http://click.linksynergy.com/fs-bin/click?id=umRNw*tA5oc&#038;subid=0&#038;offerid=94348.1&#038;type=10&#038;tmpid=3910&#038;RD_PARM0=http%3A%2F%2Fitunes.apple.com%2Fjp%2Fapp%2Ftweetoverview-tl-yi-wangdesukusaidoapuri%2Fid512174889%3Fmt%3D8%2526uo%3D4&#038;RD_PARM1=http%3A%2F%2Fitunes.apple.com%2Fjp%2Fapp%2Ftweetoverview-tl-yi-wangdesukusaidoapuri%2Fid512174889%3Fmt%3D8%2526uo%3D4" rel="nofollow" target="_blank"><img src="http://a1.mzstatic.com/us/r1000/069/Purple/v4/10/55/36/1055364c-4312-37a1-5102-20cacddf3193/mza_3495649391007043356.1024x1024-65.jpg" class="iPadPortrait" width="240" height="320" /></a>　<a href="http://click.linksynergy.com/fs-bin/click?id=umRNw*tA5oc&#038;subid=0&#038;offerid=94348.1&#038;type=10&#038;tmpid=3910&#038;RD_PARM0=http%3A%2F%2Fitunes.apple.com%2Fjp%2Fapp%2Ftweetoverview-tl-yi-wangdesukusaidoapuri%2Fid512174889%3Fmt%3D8%2526uo%3D4&#038;RD_PARM1=http%3A%2F%2Fitunes.apple.com%2Fjp%2Fapp%2Ftweetoverview-tl-yi-wangdesukusaidoapuri%2Fid512174889%3Fmt%3D8%2526uo%3D4" rel="nofollow" target="_blank"><img src="http://a1.mzstatic.com/us/r1000/080/Purple/v4/dd/e7/da/dde7dac9-4a75-b6d6-a8a2-569b0df50b0f/mza_2762703113809965194.1024x1024-65.jpg" class="iPadPortrait" width="240" height="320" /></a></div>
<p><img border="0" width="1" height="1" src="http://ad.linksynergy.com/fs-bin/show?id=Dk8JKvDVYwE&#038;bids=186984.200232&#038;type=3&#038;subid=0"></p>
<p>今回の目玉は、</p>
<ol>
<li>Pocket連携</li>
<li>検索ストリーム対応</li>
<li>ハッシュタグツイート対応</li>
</ol>
<p>の３点です。<span id="more-619"></span></p>
<ul>
<li>Pocket連携</li>
<p>こちらはユーザーからのリクエストでしたが、使ってみると便利ですね。Tweet及び、表示中のURLをPocketに送って後で読むことが出来ます。リクエストがあれば、Instapaperなども対応します！<br />
<figure id="attachment_621" class="wp-caption aligncenter" style="width: 225px"><a href="http://www.zero4racer.com/blog/wp-content/uploads/2012/05/IMG_0058.png"><img src="http://www.zero4racer.com/blog/wp-content/uploads/2012/05/IMG_0058-225x300.png" alt="Pocketに送る" title="Pocketに送る" width="225" height="300" class="size-medium wp-image-621" /></a><figcaption class="wp-caption-text">Pocketに送る</figcaption></figure><br />
そしてPocketで読める（参照のTweetも見れる）<br />
<figure id="attachment_622" class="wp-caption aligncenter" style="width: 225px"><a href="http://www.zero4racer.com/blog/wp-content/uploads/2012/05/IMG_0060.png"><img src="http://www.zero4racer.com/blog/wp-content/uploads/2012/05/IMG_0060-225x300.png" alt="Pocketでの閲覧" title="Pocketでの閲覧" width="225" height="300" class="size-medium wp-image-622" /></a><figcaption class="wp-caption-text">Pocketでの閲覧</figcaption></figure><br />
PocketのiOS APIは、何とiPhoneOS2.0時台のもので、使えるものの、結構書き換えました。３年間でのiOSSDKの変化がよく分かるものでした。</p>
<li>検索ストリーム対応</li>
<p>こちらが今回のメインポイントです。TwitterのストリーミングAPIを使って、複数検索を同時に行う事が出来ます。気になるテクノロジー、自社プロダクト、ハッシュタグ、勉強会など、気になる話題をタイムラインと同時に見ることが出来ます。ただ、ストリーミングAPIが、日本語の文節区切りにうまく対応していないようで、前後にスペースや記号が無いと、正しく単語を検索してくれないようです。これは追って対応したいと思います。<br />
<figure id="attachment_623" class="wp-caption aligncenter" style="width: 225px"><a href="http://www.zero4racer.com/blog/wp-content/uploads/2012/05/IMG_0055.png"><img src="http://www.zero4racer.com/blog/wp-content/uploads/2012/05/IMG_0055-225x300.png" alt="複数単語の検索ストリーミング" title="複数単語の検索ストリーミング" width="225" height="300" class="size-medium wp-image-623" /></a><figcaption class="wp-caption-text">複数単語の検索ストリーミング</figcaption></figure><br />
単語単位でon/offできます。<br />
<figure id="attachment_624" class="wp-caption aligncenter" style="width: 225px"><a href="http://www.zero4racer.com/blog/wp-content/uploads/2012/05/IMG_0061.png"><img src="http://www.zero4racer.com/blog/wp-content/uploads/2012/05/IMG_0061-225x300.png" alt="複数単語同時検索できます" title="複数単語同時検索できます" width="225" height="300" class="size-medium wp-image-624" /></a><figcaption class="wp-caption-text">複数単語同時検索できます</figcaption></figure><br />
これで、ハッシュタグとタイムラインを自動に追うことが出来ます。</p>
<li>ハッシュタグツイート対応</li>
<p>こちらは、上の検索と関係して、勉強会に参加しているときなどに、特定のタグについて呟きたいというニーズを満たすために作りました。<br />
<figure id="attachment_625" class="wp-caption aligncenter" style="width: 225px"><a href="http://www.zero4racer.com/blog/wp-content/uploads/2012/05/IMG_0056.png"><img src="http://www.zero4racer.com/blog/wp-content/uploads/2012/05/IMG_0056-225x300.png" alt="初期テキストを入力" title="初期テキストを入力" width="225" height="300" class="size-medium wp-image-625" /></a><figcaption class="wp-caption-text">初期テキストを入力</figcaption></figure><br />
ハッシュタグツイートが簡単に。<br />
<figure id="attachment_626" class="wp-caption aligncenter" style="width: 225px"><a href="http://www.zero4racer.com/blog/wp-content/uploads/2012/05/IMG_0057.png"><img src="http://www.zero4racer.com/blog/wp-content/uploads/2012/05/IMG_0057-225x300.png" alt="ハッシュタグツイート" title="ハッシュタグツイート" width="225" height="300" class="size-medium wp-image-626" /></a><figcaption class="wp-caption-text">ハッシュタグツイート</figcaption></figure><br />
カーソルが最後に来ているのは、修正した方がよいのは分かるのですが、後日対応とさせてください。</p>
</ul>
<p>以上、最新機能のまとめでした。よろしかったら使用してください！</p>
<div id="tweetbutton619" class="tw_button" style="float:right;margin-left:10px;"><a href="http://twitter.com/share?url=http%3A%2F%2Fwww.zero4racer.com%2Fblog%2F619&amp;via=tomohisa&amp;text=Pocket%E9%80%A3%E6%90%BA%E3%80%81%E6%A4%9C%E7%B4%A2%E3%82%B9%E3%83%88%E3%83%AA%E3%83%BC%E3%83%A0%E3%80%81%E3%83%8F%E3%83%83%E3%82%B7%E3%83%A5%E3%82%BF%E3%82%B0%E3%83%84%E3%82%A4%E3%83%BC%E3%83%88%E3%81%AA%E3%81%A9%E3%81%AE%E5%85%A5%E3%81%A3%E3%81%9F%E3%80%81TweetOverview...%20&amp;related=tomohisa:iPhone+Developer+Tomohisa+Takaoka+at+J-Tech+Creations%2C+Inc.&amp;lang=en&amp;count=horizontal&amp;counturl=http%3A%2F%2Fwww.zero4racer.com%2Fblog%2F619" class="twitter-share-button"  style="width:55px;height:22px;background:transparent url('http://www.zero4racer.com/blog/wp-content/plugins/wp-tweet-button/tweetn.png') no-repeat  0 0;text-align:left;text-indent:-9999px;display:block;">Tweet</a></div>]]></content:encoded>
			<wfw:commentRss>http://www.zero4racer.com/blog/619/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>TweetOverviewリリース！期間限定、アプリについてツイートすれば広告が削除されるキャンペーン実施中</title>
		<link>http://www.zero4racer.com/blog/602</link>
		<comments>http://www.zero4racer.com/blog/602#comments</comments>
		<pubDate>Mon, 23 Apr 2012 21:53:22 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Promotions]]></category>
		<category><![CDATA[TweetOverview]]></category>

		<guid isPermaLink="false">http://www.zero4racer.com/blog/?p=602</guid>
		<description><![CDATA[Tweetデスクサイドにおく、タイムラインビューアーアプリが欲しかったので、自作しました。 iTunes ストアへのリンクはこちら。 TweetOverview TL一望デスクサイドアプリ カテゴリ: ソーシャルネットワ [...]]]></description>
			<content:encoded><![CDATA[<div id="tweetbutton602" class="tw_button" style="float:right;margin-left:10px;"><a href="http://twitter.com/share?url=http%3A%2F%2Fwww.zero4racer.com%2Fblog%2F602&amp;via=tomohisa&amp;text=TweetOverview%E3%83%AA%E3%83%AA%E3%83%BC%E3%82%B9%EF%BC%81%E6%9C%9F%E9%96%93%E9%99%90%E5%AE%9A%E3%80%81%E3%82%A2%E3%83%97%E3%83%AA%E3%81%AB%E3%81%A4%E3%81%84%E3%81%A6%E3%83%84%E3%82%A4%E3%83%BC%E3%83%88%E3%81%99%E3%82%8C%E3%81%B0%E5%BA%83%E5%91%8A%E3%81%8C%E5%89%8A%E9%99%A4%E3%81%95%E3%82%8C%E3%82%8B%E3%82%AD%E3%83%A3%E3%83%B3%E3%83%9A%E3%83%BC%E3%83%B3%E5%AE%9F%E6%96%BD%E4%B8%AD...%20&amp;related=tomohisa:iPhone+Developer+Tomohisa+Takaoka+at+J-Tech+Creations%2C+Inc.&amp;lang=en&amp;count=horizontal&amp;counturl=http%3A%2F%2Fwww.zero4racer.com%2Fblog%2F602" class="twitter-share-button"  style="width:55px;height:22px;background:transparent url('http://www.zero4racer.com/blog/wp-content/plugins/wp-tweet-button/tweetn.png') no-repeat  0 0;text-align:left;text-indent:-9999px;display:block;">Tweet</a></div><p>デスクサイドにおく、タイムラインビューアーアプリが欲しかったので、自作しました。<br />
<iframe width="420" height="315" src="http://www.youtube.com/embed/w6OR26zFua0" frameborder="0" allowfullscreen></iframe><br />
iTunes ストアへのリンクはこちら。<br />
<figure id="attachment_603" class="wp-caption aligncenter" style="width: 562px"><a href="http://itunes.apple.com/jp/app/tweetoverview-desk-side-timeline/id512174889?lang=ja&amp;mt=8"><img src="http://www.zero4racer.com/blog/wp-content/uploads/2012/04/overview_icon_web512d.png" alt="TweetOverview アイコン" title="TweetOverview アイコン" width="562" height="562" class="size-full wp-image-603" /></a><figcaption class="wp-caption-text">TweetOverview アイコン</figcaption></figure><br />
<a href="http://click.linksynergy.com/fs-bin/click?id=umRNw*tA5oc&#038;subid=0&#038;offerid=94348.1&#038;type=10&#038;tmpid=3910&#038;RD_PARM0=http%3A%2F%2Fitunes.apple.com%2Fjp%2Fapp%2Ftweetoverview-tl-yi-wangdesukusaidoapuri%2Fid512174889%3Fmt%3D8%2526uo%3D4&#038;RD_PARM1=http%3A%2F%2Fitunes.apple.com%2Fjp%2Fapp%2Ftweetoverview-tl-yi-wangdesukusaidoapuri%2Fid512174889%3Fmt%3D8%2526uo%3D4" rel="nofollow" target="_blank"><img align="left" hspace="6" src="http://a1.mzstatic.com/us/r30/Purple/v4/61/b0/1a/61b01a36-b14d-5259-5fa9-395739eff92b/Icon.png" width="75" style="margin-right: 6px;" /><b>TweetOverview TL一望デスクサイドアプリ</b> <img alt="App" src="http://ax.phobos.apple.com.edgesuite.net/ja_jp/images/web/linkmaker/badge_appstore-sm.gif" style="vertical-align: text-bottom;" /></b><br />
</a>カテゴリ: ソーシャルネットワーキング<br />
価格: 無料<br clear="all" /><br />
<img border="0" width="1" height="1" src="http://ad.linksynergy.com/fs-bin/show?id=Dk8JKvDVYwE&#038;bids=186984.200232&#038;type=3&#038;subid=0"></p>
<p><span id="more-602"></span><br />
今回のアプリでは、無料アプリプラス広告削除アドオンの手法をとっています。<a href="http://www.zero4racer.com/blog/81">iPhoneアプリ：無料版と有料版、一緒に組み込んでみるのはいかが？ | Zero4Racer PRO Developer&#8217;s Blog </a>こちらの記事にある様に、アプリがまず認知される事が重要なので、この方法は、広告を打つほどの認知度や資金の無いデベロッパーにはよいのではないかと思います。</p>
<p>そして、認知度を上げるために、今回のアプリでは、ツイッターでアプリについてツイートすれば、広告が削除されるキャンペーンを行って見ています。<br />
<figure id="attachment_604" class="wp-caption aligncenter" style="width: 776px"><a href="http://tweetoverview.net/campaignjp/start"><img src="http://www.zero4racer.com/blog/wp-content/uploads/2012/04/Screen-Shot-2012-04-23-at-1.08.59-PM.png" alt="無料キャンペーンサイト" title="無料キャンペーンサイト" width="776" height="973" class="size-full wp-image-604" /></a><figcaption class="wp-caption-text">無料キャンペーンサイト</figcaption></figure></p>
<p>このサイトの仕組みは、</p>
<ol>
<li>キャンペーンサイトからツイートしたら、キャンペーンサイトに、ツイッターユーザーIDを登録</li>
<p>これは、twitterアプリケーションをウェブで作成しています。<br />
<figure id="attachment_606" class="wp-caption aligncenter" style="width: 827px"><a href="http://www.zero4racer.com/blog/wp-content/uploads/2012/04/Screen-Shot-2012-04-23-at-2.29.02-PM.png"><img src="http://www.zero4racer.com/blog/wp-content/uploads/2012/04/Screen-Shot-2012-04-23-at-2.29.02-PM.png" alt="Twitterアプリの使用許可" title="Twitterアプリの使用許可" width="827" height="740" class="size-full wp-image-606" /></a><figcaption class="wp-caption-text">Twitterアプリの使用許可</figcaption></figure><br />
これで連携が取れたら、定型文にコメントを入れてツイートすることが出来ます。<br />
<figure id="attachment_607" class="wp-caption aligncenter" style="width: 793px"><a href="http://www.zero4racer.com/blog/wp-content/uploads/2012/04/Screen-Shot-2012-04-23-at-2.33.13-PM.png"><img src="http://www.zero4racer.com/blog/wp-content/uploads/2012/04/Screen-Shot-2012-04-23-at-2.33.13-PM.png" alt="ツイート文入力" title="ツイート文入力" width="793" height="718" class="size-full wp-image-607" /></a><figcaption class="wp-caption-text">ツイート文入力</figcaption></figure><br />
そして、キャンペーンサイトからツイートを行うと、広告削除権がアカウントに与えられます。</p>
<li>iPad上での広告の削除</li>
<p>iPad上での広告の削除は、アプリに設定した、URLスキームを、クリックすることによって、次の様に行っています。</p>
<ul>
<li>Twitterフレームワークから、ツイッターのアカウント名を取得</li>
<li>キャンペーンサイトに、キャンペーンに登録したかを問い合わせる</li>
<li>キャンペーンに登録したツイッターアカウントは、広告削除権を与えられる</li>
</ul>
</ol>
<p>という仕組みです。このキャンペーンの特徴は、<strong>Twitterのアカウント認証を行っているが、キャンペーンサイトも、アプリも、全くユーザー自身がパスワードを入れる必要なく、ユーザーの確認ができる</strong>という事です。</p>
<p>Webサイトでも，元々ログインしていればパスワードを入れず、アプリ認証のクリックをするだけでよいですし、iPadに既にTwitterを設定してあれば、アカウントは既に認証されています。ですから、アカウント名だけ、確認する事でユーザーが既にキャンペーンに応募したかを確認することが出来るという点です。</p>
<p>有料の広告削除権を無料でキャンペーンで提供することによって、収益源がアプリからは無くなりますが、期間限定で、アプリについてのツイートがどれくらいアプリの認知に影響するかをテストするのによいかなと思いました。いまなら、無料で広告を削除出来ますので、よろしかったら無料のtweetOverview試してみてください。<br />
<a href="http://tweetoverview.net/campaignjp/start">TweetOverview キャンペーンの情報はこちら </a></p>
<table border="0" style="line-height: 1.2em;">
<tr>
<td rowspan="9" width="75px" style="padding: 0; vertical-align: top; border:0px;"><a href="http://click.linksynergy.com/fs-bin/click?id=umRNw*tA5oc&#038;subid=0&#038;offerid=94348.1&#038;type=10&#038;tmpid=3910&#038;RD_PARM0=http%3A%2F%2Fitunes.apple.com%2Fjp%2Fapp%2Ftweetoverview-tl-yi-wangdesukusaidoapuri%2Fid512174889%3Fmt%3D8%2526uo%3D4&#038;RD_PARM1=http%3A%2F%2Fitunes.apple.com%2Fjp%2Fapp%2Ftweetoverview-tl-yi-wangdesukusaidoapuri%2Fid512174889%3Fmt%3D8%2526uo%3D4" rel="nofollow" target="_blank"><img src="http://a1.mzstatic.com/us/r30/Purple/v4/61/b0/1a/61b01a36-b14d-5259-5fa9-395739eff92b/Icon.png" width="75" /></a></td>
<td colspan="2"><a href="http://click.linksynergy.com/fs-bin/click?id=umRNw*tA5oc&#038;subid=0&#038;offerid=94348.1&#038;type=10&#038;tmpid=3910&#038;RD_PARM0=http%3A%2F%2Fitunes.apple.com%2Fjp%2Fapp%2Ftweetoverview-tl-yi-wangdesukusaidoapuri%2Fid512174889%3Fmt%3D8%2526uo%3D4&#038;RD_PARM1=http%3A%2F%2Fitunes.apple.com%2Fjp%2Fapp%2Ftweetoverview-tl-yi-wangdesukusaidoapuri%2Fid512174889%3Fmt%3D8%2526uo%3D4" rel="nofollow" target="_blank"><strong>TweetOverview TL一望デスクサイドアプリ</strong> <small>(Version 1.0.0)</small> <img alt="App" src="http://ax.phobos.apple.com.edgesuite.net/ja_jp/images/web/linkmaker/badge_appstore-sm.gif" style="vertical-align: text-bottom;" /></a></td>
</tr>
<tr>
<td width="120px">カテゴリ:</td>
<td>ソーシャルネットワーキング</td>
</tr>
<tr>
<td>価格:</td>
<td>無料</td>
</tr>
<tr>
<td>デベロッパ名:</td>
<td>J-Tech Creations, Inc.</td>
</tr>
<tr>
<td>リリース日:</td>
<td>2012/04/23</td>
</tr>
<tr>
<td>対応デバイス:</td>
<td>iPad Wi-Fi / iPad 2 Wi-Fi / iPad 2 Wi-Fi+3G / iPad Wi-Fi+3G</td>
</tr>
<tr>
<td>現Ver.の平均評価:</td>
<td> (無し /  0件の評価)</td>
</tr>
<tr>
<td>通算の平均評価:</td>
<td> (無し / 0件の評価)</td>
</tr>
<tr>
<td>Game Center:</td>
<td>非対応</td>
</tr>
</table>
<div align="center" style="margin: 5px;"><a href="http://click.linksynergy.com/fs-bin/click?id=umRNw*tA5oc&#038;subid=0&#038;offerid=94348.1&#038;type=10&#038;tmpid=3910&#038;RD_PARM0=http%3A%2F%2Fitunes.apple.com%2Fjp%2Fapp%2Ftweetoverview-tl-yi-wangdesukusaidoapuri%2Fid512174889%3Fmt%3D8%2526uo%3D4&#038;RD_PARM1=http%3A%2F%2Fitunes.apple.com%2Fjp%2Fapp%2Ftweetoverview-tl-yi-wangdesukusaidoapuri%2Fid512174889%3Fmt%3D8%2526uo%3D4" rel="nofollow" target="_blank"><img src="http://a1.mzstatic.com/us/r30/Purple/v4/7f/76/0b/7f760b8f-5b96-781c-0b56-932ce1d65eb9/mza_2756599959014103219.1024x1024-65.jpg" class="iPadPortrait" width="240" height="320" /></a>　<a href="http://click.linksynergy.com/fs-bin/click?id=umRNw*tA5oc&#038;subid=0&#038;offerid=94348.1&#038;type=10&#038;tmpid=3910&#038;RD_PARM0=http%3A%2F%2Fitunes.apple.com%2Fjp%2Fapp%2Ftweetoverview-tl-yi-wangdesukusaidoapuri%2Fid512174889%3Fmt%3D8%2526uo%3D4&#038;RD_PARM1=http%3A%2F%2Fitunes.apple.com%2Fjp%2Fapp%2Ftweetoverview-tl-yi-wangdesukusaidoapuri%2Fid512174889%3Fmt%3D8%2526uo%3D4" rel="nofollow" target="_blank"><img src="http://a1.mzstatic.com/us/r30/Purple/v4/5b/7c/9c/5b7c9c18-1656-7316-0879-d7ba6602663a/mza_6133935387163659868.1024x1024-65.jpg" class="iPadPortrait" width="240" height="320" /></a></div>
<p><img border="0" width="1" height="1" src="http://ad.linksynergy.com/fs-bin/show?id=Dk8JKvDVYwE&#038;bids=186984.200232&#038;type=3&#038;subid=0"></p>
<div id="tweetbutton602" class="tw_button" style="float:right;margin-left:10px;"><a href="http://twitter.com/share?url=http%3A%2F%2Fwww.zero4racer.com%2Fblog%2F602&amp;via=tomohisa&amp;text=TweetOverview%E3%83%AA%E3%83%AA%E3%83%BC%E3%82%B9%EF%BC%81%E6%9C%9F%E9%96%93%E9%99%90%E5%AE%9A%E3%80%81%E3%82%A2%E3%83%97%E3%83%AA%E3%81%AB%E3%81%A4%E3%81%84%E3%81%A6%E3%83%84%E3%82%A4%E3%83%BC%E3%83%88%E3%81%99%E3%82%8C%E3%81%B0%E5%BA%83%E5%91%8A%E3%81%8C%E5%89%8A%E9%99%A4%E3%81%95%E3%82%8C%E3%82%8B%E3%82%AD%E3%83%A3%E3%83%B3%E3%83%9A%E3%83%BC%E3%83%B3%E5%AE%9F%E6%96%BD%E4%B8%AD...%20&amp;related=tomohisa:iPhone+Developer+Tomohisa+Takaoka+at+J-Tech+Creations%2C+Inc.&amp;lang=en&amp;count=horizontal&amp;counturl=http%3A%2F%2Fwww.zero4racer.com%2Fblog%2F602" class="twitter-share-button"  style="width:55px;height:22px;background:transparent url('http://www.zero4racer.com/blog/wp-content/plugins/wp-tweet-button/tweetn.png') no-repeat  0 0;text-align:left;text-indent:-9999px;display:block;">Tweet</a></div>]]></content:encoded>
			<wfw:commentRss>http://www.zero4racer.com/blog/602/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Blocksで記述出来るiPad用のPopOverMenuと通知のクラスを公開しました</title>
		<link>http://www.zero4racer.com/blog/590</link>
		<comments>http://www.zero4racer.com/blog/590#comments</comments>
		<pubDate>Thu, 19 Apr 2012 18:23:34 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Objective-C]]></category>
		<category><![CDATA[Promotions]]></category>
		<category><![CDATA[TweetOverview]]></category>
		<category><![CDATA[UIKit]]></category>

		<guid isPermaLink="false">http://www.zero4racer.com/blog/?p=590</guid>
		<description><![CDATA[Tweet追記4/21/2012：メモリ管理関係のバグを修正しました。Githubの最新をご覧下さい。 ただいま、作成中のアプリ、TweetOverviewのサブミットも終了し、現在審査の終了を待っているところです。開発 [...]]]></description>
			<content:encoded><![CDATA[<div id="tweetbutton590" class="tw_button" style="float:right;margin-left:10px;"><a href="http://twitter.com/share?url=http%3A%2F%2Fwww.zero4racer.com%2Fblog%2F590&amp;via=tomohisa&amp;text=Blocks%E3%81%A7%E8%A8%98%E8%BF%B0%E5%87%BA%E6%9D%A5%E3%82%8BiPad%E7%94%A8%E3%81%AEPopOverMenu%E3%81%A8%E9%80%9A%E7%9F%A5%E3%81%AE%E3%82%AF%E3%83%A9%E3%82%B9%E3%82%92%E5%85%AC%E9%96%8B%E3%81%97%E3%81%BE%E3%81%97%E3%81%9F%20-%20Zero4Racer...%20&amp;related=tomohisa:iPhone+Developer+Tomohisa+Takaoka+at+J-Tech+Creations%2C+Inc.&amp;lang=en&amp;count=horizontal&amp;counturl=http%3A%2F%2Fwww.zero4racer.com%2Fblog%2F590" class="twitter-share-button"  style="width:55px;height:22px;background:transparent url('http://www.zero4racer.com/blog/wp-content/plugins/wp-tweet-button/tweetn.png') no-repeat  0 0;text-align:left;text-indent:-9999px;display:block;">Tweet</a></div><p><strong>追記4/21/2012：メモリ管理関係のバグを修正しました。Githubの最新をご覧下さい。</strong></p>
<p>ただいま、作成中のアプリ、TweetOverviewのサブミットも終了し、現在審査の終了を待っているところです。開発中はこんな感じです。<br />
<iframe width="420" height="315" src="http://www.youtube.com/embed/w6OR26zFua0" frameborder="0" allowfullscreen></iframe></p>
<p>このアプリのために作成した、共通で使えそうなクラスを共有します。最初に動作のビデオ<br />
<iframe width="420" height="315" src="http://www.youtube.com/embed/4ZkTYuHjoq4" frameborder="0" allowfullscreen></iframe><br />
<span id="more-590"></span></p>
<h2>TOVLinkPopoverViewController</h2>
<p>こちらはUIPopOverControllerを使って簡単にメニューを出すために作りました。<br />
<figure id="attachment_591" class="wp-caption aligncenter" style="width: 1024px"><a href="http://www.zero4racer.com/blog/wp-content/uploads/2012/04/IMG_0016.png"><img src="http://www.zero4racer.com/blog/wp-content/uploads/2012/04/IMG_0016-1024x768.png" alt="PopOver動作サンプル" title="PopOver動作サンプル" width="1024" height="768" class="size-large wp-image-591" /></a><figcaption class="wp-caption-text">PopOver動作サンプル</figcaption></figure></p>
<p>このように動作します。このためのコードは簡単にはこのように動作しています。</p>
<ul>
<li>PopOver表示用のNSMutableArrayを作成</li>
<li>Arrayに、表示項目と、実行用のBlockを登録</li>
<li>PopOverを表示する</li>
</ul>
<p>このような感じです。これと直接は関係ありませんが、UIToolbarのイベントから、位置を取得する用にも作っています。</p>
<div class="codecolorer-container text mac-classic" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">-(IBAction)clickedButtonA:(UIBarButtonItem*)sender event:(UIEvent*)event {<br />
....<br />
&nbsp; &nbsp; controller.parentPop = _myPop;<br />
&nbsp; &nbsp; _myPop.popoverContentSize = CGSizeMake(400, 44*arrRows.count+16);<br />
&nbsp; &nbsp; // &nbsp; &nbsp;pop.delegate = self;<br />
&nbsp; &nbsp; UIView *button;<br />
&nbsp; &nbsp; for( UITouch* touch in [event allTouches] ) { <br />
&nbsp; &nbsp; &nbsp; &nbsp; if( [touch phase] == UITouchPhaseEnded ) { <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; button = [touch view]; <br />
&nbsp; &nbsp; &nbsp; &nbsp; } <br />
&nbsp; &nbsp; }<br />
&nbsp; &nbsp; CGRect rect = CGRectMake(button.frame.origin.x + button.superview.frame.origin.x, button.frame.origin.y + button.superview.frame.origin.y, button.frame.size.width, button.frame.size.height);<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; [_myPop presentPopoverFromRect:rect inView:self.view permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];</div></td></tr></tbody></table></div>
<p>このように、eventをとって、タッチをとることによって、ボタンの押された位置から、ポップオーバーを出すことが出来ます。<br />
そして、<a href="http://www.zero4racer.com/blog/579">あのblocksは大丈夫？iOSで、blocksを使った記述で、リリースビルドのみにクラッシュする事例 | Zero4Racer PRO Developer&#8217;s Blog </a>で参照した様に、このコードは、リリースのみでクラッシュする状況があります。その検証用に４パターンコードで書いていますが、おそらくの最適解は、<strong>blockを、NSMutableDictionaryに登録する際に、そのまま登録すると、retainされてしまうため、[block copy]をして、明示的にコピーしてあげることによって，内部で使用している変数がキャプチャされて、リテインされるので、正しく動作する</strong>のかなと考えているのですが、未だ曖昧です。</p>
<p>呼び出しのサンプルコードはこの様になっています。</p>
<div class="codecolorer-container text mac-classic" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br />23<br />24<br />25<br />26<br />27<br />28<br />29<br />30<br />31<br />32<br />33<br />34<br />35<br />36<br />37<br />38<br />39<br />40<br />41<br />42<br />43<br />44<br />45<br />46<br />47<br />48<br />49<br />50<br />51<br />52<br />53<br />54<br />55<br />56<br />57<br />58<br />59<br />60<br />61<br />62<br />63<br />64<br />65<br />66<br />67<br />68<br />69<br />70<br />71<br />72<br />73<br />74<br />75<br />76<br />77<br />78<br />79<br />80<br />81<br />82<br />83<br />84<br />85<br />86<br />87<br />88<br />89<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">-(IBAction)clickedButtonA:(UIBarButtonItem*)sender event:(UIEvent*)event {<br />
<br />
&nbsp; &nbsp; NSMutableArray *arrRows = [NSMutableArray arrayWithCapacity:0];<br />
&nbsp; &nbsp; {<br />
#warning this code only crash on Release Build.... Don't use this<br />
&nbsp; &nbsp; &nbsp; &nbsp; NSMutableDictionary * dicRow = [NSMutableDictionary dictionaryWithCapacity:0];<br />
&nbsp; &nbsp; &nbsp; &nbsp; [dicRow setValue:NSLocalizedString(@&quot;Pattern 1 Crash&quot;,nil) forKey:kDicKeyLinkPopCellText];<br />
&nbsp; &nbsp; &nbsp; &nbsp; [arrRows addObject:dicRow];<br />
&nbsp; &nbsp; &nbsp; &nbsp; dispatch_block_t block = ^{<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; NSString *str = [NSString stringWithFormat:@&quot;%@&quot;,[_tweet valueForKey:@&quot;text&quot;]];<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [[UIPasteboard generalPasteboard] setString:str];<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [[JTCAppNotificationManager sharedManger] startTimerNotificationWithMessage:NSLocalizedString(@&quot;Copy succeeded&quot;, @&quot;Copy succeeded&quot;) dulation:2.5 iconName:@&quot;w17-check.png&quot;];<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; };<br />
&nbsp; &nbsp; &nbsp; &nbsp; [dicRow setValue:block forKey:kDicKeyLinkPopBlock];<br />
&nbsp; &nbsp; }<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; NSMutableDictionary * dicRow = [NSMutableDictionary dictionaryWithCapacity:0];<br />
&nbsp; &nbsp; &nbsp; &nbsp; [dicRow setValue:NSLocalizedString(@&quot;Pattern 2 __block&quot;,nil) forKey:kDicKeyLinkPopCellText];<br />
&nbsp; &nbsp; &nbsp; &nbsp; [arrRows addObject:dicRow];<br />
#warning this code is not the way recommended how to use __block ... not recommended<br />
&nbsp; &nbsp; &nbsp; &nbsp; __block id bt = _tweet;<br />
&nbsp; &nbsp; &nbsp; &nbsp; dispatch_block_t block = ^{<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; NSString *str = [NSString stringWithFormat:@&quot;%@&quot;,[bt valueForKey:@&quot;text&quot;]];<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [[UIPasteboard generalPasteboard] setString:str];<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [[JTCAppNotificationManager sharedManger] startTimerNotificationWithMessage:NSLocalizedString(@&quot;Copy succeeded&quot;, @&quot;Copy succeeded&quot;) dulation:2.5 iconName:@&quot;w17-check.png&quot;];<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; };<br />
&nbsp; &nbsp; &nbsp; &nbsp; [dicRow setValue:block forKey:kDicKeyLinkPopBlock];<br />
&nbsp; &nbsp; }<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; NSMutableDictionary * dicRow = [NSMutableDictionary dictionaryWithCapacity:0];<br />
&nbsp; &nbsp; &nbsp; &nbsp; [dicRow setValue:NSLocalizedString(@&quot;Pattern 3 only declare bt crash&quot;,nil) forKey:kDicKeyLinkPopCellText];<br />
&nbsp; &nbsp; &nbsp; &nbsp; [arrRows addObject:dicRow];<br />
#warning this code only crash on Release Build.... Don't use this<br />
&nbsp; &nbsp; &nbsp; &nbsp; id bt = _tweet;<br />
&nbsp; &nbsp; &nbsp; &nbsp; dispatch_block_t block = ^{<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; NSString *str = [NSString stringWithFormat:@&quot;%@&quot;,[bt valueForKey:@&quot;text&quot;]];<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [[UIPasteboard generalPasteboard] setString:str];<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [[JTCAppNotificationManager sharedManger] startTimerNotificationWithMessage:NSLocalizedString(@&quot;Copy succeeded&quot;, @&quot;Copy succeeded&quot;) dulation:2.5 iconName:@&quot;w17-check.png&quot;];<br />
&nbsp; &nbsp; &nbsp; &nbsp; };<br />
&nbsp; &nbsp; &nbsp; &nbsp; [dicRow setValue:block forKey:kDicKeyLinkPopBlock];<br />
&nbsp; &nbsp; }<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; NSMutableDictionary * dicRow = [NSMutableDictionary dictionaryWithCapacity:0];<br />
&nbsp; &nbsp; &nbsp; &nbsp; [dicRow setValue:NSLocalizedString(@&quot;USE THIS:Pattern 4 declare bt and copy block&quot;,nil) forKey:kDicKeyLinkPopCellText];<br />
&nbsp; &nbsp; &nbsp; &nbsp; [arrRows addObject:dicRow];<br />
&nbsp; &nbsp; &nbsp; &nbsp; id bt = _tweet;<br />
&nbsp; &nbsp; &nbsp; &nbsp; dispatch_block_t block = ^{<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; NSString *str = [NSString stringWithFormat:@&quot;%@&quot;,[bt valueForKey:@&quot;text&quot;]];<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [[UIPasteboard generalPasteboard] setString:str];<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [[JTCAppNotificationManager sharedManger] startTimerNotificationWithMessage:NSLocalizedString(@&quot;Copy succeeded&quot;, @&quot;Copy succeeded&quot;) dulation:2.5 iconName:@&quot;w17-check.png&quot;];<br />
&nbsp; &nbsp; &nbsp; &nbsp; };<br />
&nbsp; &nbsp; &nbsp; &nbsp; [dicRow setValue:[block copy] forKey:kDicKeyLinkPopBlock];<br />
&nbsp; &nbsp; }<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; NSMutableArray *sections = [NSMutableArray arrayWithObject:arrRows];<br />
&nbsp; &nbsp; TOVLinkPopoverViewController *controller= [[TOVLinkPopoverViewController alloc] init];<br />
&nbsp; &nbsp; controller.arrayLink = sections;<br />
&nbsp; &nbsp; _myPop = [[UIPopoverController alloc] initWithContentViewController:controller];<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; controller.parentPop = _myPop;<br />
&nbsp; &nbsp; _myPop.popoverContentSize = CGSizeMake(400, 44*arrRows.count+16);<br />
&nbsp; &nbsp; // &nbsp; &nbsp;pop.delegate = self;<br />
&nbsp; &nbsp; UIView *button;<br />
&nbsp; &nbsp; for( UITouch* touch in [event allTouches] ) { <br />
&nbsp; &nbsp; &nbsp; &nbsp; if( [touch phase] == UITouchPhaseEnded ) { <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; button = [touch view]; <br />
&nbsp; &nbsp; &nbsp; &nbsp; } <br />
&nbsp; &nbsp; }<br />
&nbsp; &nbsp; CGRect rect = CGRectMake(button.frame.origin.x + button.superview.frame.origin.x, button.frame.origin.y + button.superview.frame.origin.y, button.frame.size.width, button.frame.size.height);<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; [_myPop presentPopoverFromRect:rect inView:self.view permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];<br />
<br />
<br />
<br />
}</div></td></tr></tbody></table></div>
<h2>TimerNotification</h2>
<p>続いてのサンプルは，タイマーで表示するNotificationです。こちら非常に簡単に使えて、</p>
<div class="codecolorer-container text mac-classic" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp; &nbsp; [[JTCAppNotificationManager sharedManger] startTimerNotificationWithMessage:NSLocalizedString(@&quot;Timer Notification Test&quot;, nil) dulation:2.5 iconName:@&quot;w17-check.png&quot;];</div></td></tr></tbody></table></div>
<p>この様に書くと、<br />
<figure id="attachment_592" class="wp-caption aligncenter" style="width: 1024px"><a href="http://www.zero4racer.com/blog/wp-content/uploads/2012/04/IMG_0017.png"><img src="http://www.zero4racer.com/blog/wp-content/uploads/2012/04/IMG_0017-1024x768.png" alt="タイマー付きNotification" title="タイマー付きNotification" width="1024" height="768" class="size-large wp-image-592" /></a><figcaption class="wp-caption-text">タイマー付きNotification</figcaption></figure><br />
このような通知が、指定時間表示されます。このタイプの通知は、一度に一つだけの表示を想定しています。</p>
<h2>IndicatorNotification.</h2>
<p>くるくる回る、Indicator付きの通知を出すためのものです。</p>
<div class="codecolorer-container text mac-classic" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp; &nbsp; dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; __block NSNumber* num;<br />
&nbsp; &nbsp; &nbsp; &nbsp; dispatch_async(dispatch_get_main_queue(), ^{<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; num = [[JTCAppNotificationManager sharedManger] startIndicationNotificationWithMessage:NSLocalizedString(@&quot;Indicator Timer Test&quot;, nil)];<br />
&nbsp; &nbsp; &nbsp; &nbsp; });<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; double delayInSeconds = 5.0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, delayInSeconds * NSEC_PER_SEC);<br />
&nbsp; &nbsp; &nbsp; &nbsp; dispatch_after(popTime, dispatch_get_main_queue(), ^(void){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [[JTCAppNotificationManager sharedManger] stopNotification:num];<br />
&nbsp; &nbsp; &nbsp; &nbsp; });<br />
&nbsp; &nbsp; });</div></td></tr></tbody></table></div>
<p>このように書くと、5秒間通知が出て、ユーザは画面を触れなくなります。このクラスの特徴は複数の通知を出すことが出来、通知毎に、NSNumberで、通知IDを返すので、指定部分だけ終了して、複数のNotificationを出すことが出来るという事です。<br />
<figure id="attachment_593" class="wp-caption aligncenter" style="width: 1024px"><a href="http://www.zero4racer.com/blog/wp-content/uploads/2012/04/IMG_0019.png"><img src="http://www.zero4racer.com/blog/wp-content/uploads/2012/04/IMG_0019-1024x768.png" alt="複数の通知を出した状態" title="複数の通知を出した状態" width="1024" height="768" class="size-large wp-image-593" /></a><figcaption class="wp-caption-text">複数の通知を出した状態</figcaption></figure><br />
このようにして、通知の出し入れが可能になります。詳しくは最初のビデオをご覧下さい。</p>
<p>これらは、GitHubにMITライセンスで提供していますので、関心のある方はご覧下さい。<br />
<a href="https://github.com/tomohisa/iOS_PopoverMenu_Notification">tomohisa/iOS_PopoverMenu_Notification </a></p>
<p>今回の件でいろいろ教えて頂いたり、調べたりして、ARC+Blocksが思った以上に正しく使うのが難しいということが分かりました。どちらにしろ、よいテストが非常に重要である事がよく分かりました。</p>
<div id="tweetbutton590" class="tw_button" style="float:right;margin-left:10px;"><a href="http://twitter.com/share?url=http%3A%2F%2Fwww.zero4racer.com%2Fblog%2F590&amp;via=tomohisa&amp;text=Blocks%E3%81%A7%E8%A8%98%E8%BF%B0%E5%87%BA%E6%9D%A5%E3%82%8BiPad%E7%94%A8%E3%81%AEPopOverMenu%E3%81%A8%E9%80%9A%E7%9F%A5%E3%81%AE%E3%82%AF%E3%83%A9%E3%82%B9%E3%82%92%E5%85%AC%E9%96%8B%E3%81%97%E3%81%BE%E3%81%97%E3%81%9F%20-%20Zero4Racer...%20&amp;related=tomohisa:iPhone+Developer+Tomohisa+Takaoka+at+J-Tech+Creations%2C+Inc.&amp;lang=en&amp;count=horizontal&amp;counturl=http%3A%2F%2Fwww.zero4racer.com%2Fblog%2F590" class="twitter-share-button"  style="width:55px;height:22px;background:transparent url('http://www.zero4racer.com/blog/wp-content/plugins/wp-tweet-button/tweetn.png') no-repeat  0 0;text-align:left;text-indent:-9999px;display:block;">Tweet</a></div>]]></content:encoded>
			<wfw:commentRss>http://www.zero4racer.com/blog/590/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>あのblocksは大丈夫？iOSで、blocksを使った記述で、リリースビルドのみにクラッシュする事例</title>
		<link>http://www.zero4racer.com/blog/579</link>
		<comments>http://www.zero4racer.com/blog/579#comments</comments>
		<pubDate>Sun, 15 Apr 2012 23:33:47 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Objective-C]]></category>
		<category><![CDATA[TweetOverview]]></category>
		<category><![CDATA[Xcode]]></category>

		<guid isPermaLink="false">http://www.zero4racer.com/blog/?p=579</guid>
		<description><![CDATA[Tweet追記：4/19/2012 @tokyopengwyn さんから指摘をいただき、安易に__blocksを追加するのがいつも正しい訳では無いというという事を教えて頂きました。この事例は、ReleaseとDebugビ [...]]]></description>
			<content:encoded><![CDATA[<div id="tweetbutton579" class="tw_button" style="float:right;margin-left:10px;"><a href="http://twitter.com/share?url=http%3A%2F%2Fwww.zero4racer.com%2Fblog%2F579&amp;via=tomohisa&amp;text=%E3%81%82%E3%81%AEblocks%E3%81%AF%E5%A4%A7%E4%B8%88%E5%A4%AB%EF%BC%9FiOS%E3%81%A7%E3%80%81blocks%E3%82%92%E4%BD%BF%E3%81%A3%E3%81%9F%E8%A8%98%E8%BF%B0%E3%81%A7%E3%80%81%E3%83%AA%E3%83%AA%E3%83%BC%E3%82%B9%E3%83%93%E3%83%AB%E3%83%89%E3%81%AE%E3%81%BF%E3%81%AB%E3%82%AF%E3%83%A9%E3%83%83%E3%82%B7%E3%83%A5%E3%81%99%E3%82%8B%E4%BA%8B%E4%BE%8B...%20&amp;related=tomohisa:iPhone+Developer+Tomohisa+Takaoka+at+J-Tech+Creations%2C+Inc.&amp;lang=en&amp;count=horizontal&amp;counturl=http%3A%2F%2Fwww.zero4racer.com%2Fblog%2F579" class="twitter-share-button"  style="width:55px;height:22px;background:transparent url('http://www.zero4racer.com/blog/wp-content/plugins/wp-tweet-button/tweetn.png') no-repeat  0 0;text-align:left;text-indent:-9999px;display:block;">Tweet</a></div><p><strong>追記：4/19/2012 @tokyopengwyn さんから指摘をいただき、安易に__blocksを追加するのがいつも正しい訳では無いというという事を教えて頂きました。この事例は、ReleaseとDebugビルドで挙動が違うことがあるというを思いに止めていただければと思います。ARC+Blocksには落とし穴も多いのでご注意ください。</strong><br />
<strong>追記：4/19/2012 ソースをgithubに公開しました。<a href="http://www.zero4racer.com/blog/590">Blocksで記述出来るiPad用のPopOverMenuと通知のクラスを公開しました | Zero4Racer PRO Developer&#8217;s Blog </a>こちらの記事から参照ください。</strong></p>
<p><strong>追記：4/21/2012　@tokyopengwyn さんの検証はこちら、分かりやすくまとめられています。 <a href="http://kakko-no-ireko.blogspot.jp/2012/04/blocks.html">One Flew Over The {()}&#8217;s Nest: Blocks関連のバグがデバッグコンパイルで再現しないケース </a></strong><br />
ただいま、作成中のアプリ、TweetOverviewが、テストフライトでのテストを行っていて、そろそろサブミット出来るかなと思っています。</p>
<p>開発中はこんな感じです。<br />
<iframe width="420" height="315" src="http://www.youtube.com/embed/w6OR26zFua0" frameborder="0" allowfullscreen></iframe></p>
<figure id="attachment_568" class="wp-caption aligncenter" style="width: 1024px"><a href="http://www.zero4racer.com/blog/wp-content/uploads/2012/04/IMG_0011.png"><img src="http://www.zero4racer.com/blog/wp-content/uploads/2012/04/IMG_0011-1024x768.png" alt="詳細画面" title="詳細画面" width="1024" height="768" class="size-large wp-image-568" /></a><figcaption class="wp-caption-text">詳細画面</figcaption></figure>
<p>Blocksを使用している部分で、<strong>リリースビルドだけでクラッシュ</strong>する場合があったので、これがそのままAppStoreに載ってたら大変なことになったと思うと、ちょっとぞくっとしました。</p>
<p><a href="http://www.zero4racer.com/blog/422">[iOS]リリースビルドでのみクラッシュする状況への対処について | Zero4Racer PRO Developer&#8217;s Blog </a>この記事で書いた事がまた原因かなと思ったのですが、今回はこちらの設定を変えても問題は治りませんでした。</p>
<p><span id="more-579"></span><br />
問題のコードはこちら。</p>
<div class="codecolorer-container text mac-classic" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp; &nbsp; &nbsp; &nbsp; dispatch_block_t block = ^{<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; NSString *str = [NSString stringWithFormat:[NSString stringWithFormat:NSLocalizedString(@&quot;%@ \n by @%@ \n(Source: %@)&quot;, @&quot;%@ \n by @%@&quot;) , [_tweet valueForKey:@&quot;text&quot;], [_tweet valueForKeyPath:@&quot;user.screen_name&quot;],[NSString stringWithFormat:@&quot;http://twitter.com/%@/status/%@&quot;,[_tweet valueForKeyPath:@&quot;user.screen_name&quot;],[_tweet valueForKeyPath:@&quot;id_str&quot;]]]];<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [[UIPasteboard generalPasteboard] setString:str];<br />
&nbsp; &nbsp; &nbsp; &nbsp; };</div></td></tr></tbody></table></div>
<p>ブロック内でコピーをするという簡単なコードですが、問題は、__blockを使用せずに、オブジェクト&#8221;_tweet&#8221;に直接触っていたという事でした。しかもこれが、debugビルドだとクラッシュしないため、通常は問題なく動いてしまうという事です。基本通り、__blockを使用して以下の様に書き直すと正しく動いてくれました。</p>
<div class="codecolorer-container text mac-classic" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp; &nbsp; &nbsp; &nbsp; __block id bt = _tweet;<br />
&nbsp; &nbsp; &nbsp; &nbsp; dispatch_block_t block = ^{<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; NSString *str = [NSString stringWithFormat:[NSString stringWithFormat:NSLocalizedString(@&quot;%@ \n by @%@ \n(Source: %@)&quot;, @&quot;%@ \n by @%@&quot;) , [bt valueForKey:@&quot;text&quot;], [bt valueForKeyPath:@&quot;user.screen_name&quot;],[NSString stringWithFormat:@&quot;http://twitter.com/%@/status/%@&quot;,[bt valueForKeyPath:@&quot;user.screen_name&quot;],[bt valueForKeyPath:@&quot;id_str&quot;]]]];<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [[UIPasteboard generalPasteboard] setString:str];<br />
&nbsp; &nbsp; &nbsp; &nbsp; };</div></td></tr></tbody></table></div>
<p><del datetime="2012-04-19T18:24:20+00:00">__block演算子は、ブロックをコピーする際に、アクセスカウンタを一つ増やし、ブロックのメモリが削除される時にアクセスカウンタを減らすことによって、ブロックの仕様に exc_bad_access を発生させないためのものです。</del><br />
詳細は、エキスパート Objective-C でどうぞ。<br />
<strong>追記：この部分ですが、__blocksを使用しない形に書き換えました。Blockをretainして、copyしていなかったために、正しくキャプチャされなかったと思います。現在はこの様になっています。</strong></p>
<div class="codecolorer-container text mac-classic" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp; &nbsp; &nbsp; &nbsp; NSMutableDictionary * dicRow = [NSMutableDictionary dictionaryWithCapacity:0];<br />
&nbsp; &nbsp; &nbsp; &nbsp; [dicRow setValue:NSLocalizedString(@&quot;USE THIS:Pattern 4 declare bt and copy block&quot;,nil) forKey:kDicKeyLinkPopCellText];<br />
&nbsp; &nbsp; &nbsp; &nbsp; [arrRows addObject:dicRow];<br />
&nbsp; &nbsp; &nbsp; &nbsp; id bt = _tweet;<br />
&nbsp; &nbsp; &nbsp; &nbsp; dispatch_block_t block = ^{<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; NSString *str = [NSString stringWithFormat:@&quot;%@&quot;,[bt valueForKey:@&quot;text&quot;]];<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [[UIPasteboard generalPasteboard] setString:str];<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [[JTCAppNotificationManager sharedManger] startTimerNotificationWithMessage:NSLocalizedString(@&quot;Copy succeeded&quot;, @&quot;Copy succeeded&quot;) dulation:2.5 iconName:@&quot;w17-check.png&quot;];<br />
&nbsp; &nbsp; &nbsp; &nbsp; };<br />
&nbsp; &nbsp; &nbsp; &nbsp; [dicRow setValue:[block copy] forKey:kDicKeyLinkPopBlock];</div></td></tr></tbody></table></div>
<p>以前よりもコードが多いですが、以前の部分は削っていた部分を、今回は削っていません。最後の部分で、ディクショナリにセットする際に、ブロックをコピーして、追加することにより、リリースビルドで落ちなくなりました。</p>
<p><iframe src="http://rcm-jp.amazon.co.jp/e/cm?lt1=_blank&#038;bc1=000000&#038;IS2=1&#038;bg1=FFFFFF&#038;fc1=000000&#038;lc1=0000FF&#038;t=zero4racer-22&#038;o=9&#038;p=8&#038;l=as1&#038;m=amazon&#038;f=ifr&#038;ref=qf_sp_asin_til&#038;asins=4844331094" style="width:120px;height:240px;" scrolling="no" marginwidth="0" marginheight="0" frameborder="0"></iframe></p>
<p>blocks, ARC は、非常に便利ですが、やはりある程度使用方法のルールを守らないと問題が起こるので注意ですね。</p>
<p><strong>追記：このコードはARCの状況ですね。質問ツイートがあったので張っときます。</strong></p>
<blockquote class="twitter-tweet" data-in-reply-to="191736300951445505" lang="ja"><p>@<a href="https://twitter.com/kasajei">kasajei</a> これはARCですね。ARCじゃない場合は、_tweetに通常のメモリ管理をしておけば大丈夫です。（retainプロパティを使うなど）</p>
<p>&mdash; Tomohisa Takaokaさん (@tomohisa) <a href="https://twitter.com/tomohisa/status/191755654304776194" data-datetime="2012-04-16T05:11:25+00:00">4月 16, 2012</a></p></blockquote>
<p><script src="//platform.twitter.com/widgets.js" charset="utf-8"></script></p>
<div id="tweetbutton579" class="tw_button" style="float:right;margin-left:10px;"><a href="http://twitter.com/share?url=http%3A%2F%2Fwww.zero4racer.com%2Fblog%2F579&amp;via=tomohisa&amp;text=%E3%81%82%E3%81%AEblocks%E3%81%AF%E5%A4%A7%E4%B8%88%E5%A4%AB%EF%BC%9FiOS%E3%81%A7%E3%80%81blocks%E3%82%92%E4%BD%BF%E3%81%A3%E3%81%9F%E8%A8%98%E8%BF%B0%E3%81%A7%E3%80%81%E3%83%AA%E3%83%AA%E3%83%BC%E3%82%B9%E3%83%93%E3%83%AB%E3%83%89%E3%81%AE%E3%81%BF%E3%81%AB%E3%82%AF%E3%83%A9%E3%83%83%E3%82%B7%E3%83%A5%E3%81%99%E3%82%8B%E4%BA%8B%E4%BE%8B...%20&amp;related=tomohisa:iPhone+Developer+Tomohisa+Takaoka+at+J-Tech+Creations%2C+Inc.&amp;lang=en&amp;count=horizontal&amp;counturl=http%3A%2F%2Fwww.zero4racer.com%2Fblog%2F579" class="twitter-share-button"  style="width:55px;height:22px;background:transparent url('http://www.zero4racer.com/blog/wp-content/plugins/wp-tweet-button/tweetn.png') no-repeat  0 0;text-align:left;text-indent:-9999px;display:block;">Tweet</a></div>]]></content:encoded>
			<wfw:commentRss>http://www.zero4racer.com/blog/579/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>デコードしたNSDataをNSJSONSerializationクラスで解析出来ない場合の対処方法</title>
		<link>http://www.zero4racer.com/blog/577</link>
		<comments>http://www.zero4racer.com/blog/577#comments</comments>
		<pubDate>Sun, 15 Apr 2012 23:02:58 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Japanese]]></category>
		<category><![CDATA[Objective-C]]></category>
		<category><![CDATA[TweetOverview]]></category>

		<guid isPermaLink="false">http://www.zero4racer.com/blog/?p=577</guid>
		<description><![CDATA[Tweetあまり一般的な事例ではないですが、Stackoverflowでもはまっている人がいるので備忘に記録しておきます。 NSJSONSerializationクラスで、データをシリアライズすることが出来るのは非常に楽 [...]]]></description>
			<content:encoded><![CDATA[<div id="tweetbutton577" class="tw_button" style="float:right;margin-left:10px;"><a href="http://twitter.com/share?url=http%3A%2F%2Fwww.zero4racer.com%2Fblog%2F577&amp;via=tomohisa&amp;text=%E3%83%87%E3%82%B3%E3%83%BC%E3%83%89%E3%81%97%E3%81%9FNSData%E3%82%92NSJSONSerialization%E3%82%AF%E3%83%A9%E3%82%B9%E3%81%A7%E8%A7%A3%E6%9E%90%E5%87%BA%E6%9D%A5%E3%81%AA%E3%81%84%E5%A0%B4%E5%90%88%E3%81%AE%E5%AF%BE%E5%87%A6%E6%96%B9%E6%B3%95%20-...%20&amp;related=tomohisa:iPhone+Developer+Tomohisa+Takaoka+at+J-Tech+Creations%2C+Inc.&amp;lang=en&amp;count=horizontal&amp;counturl=http%3A%2F%2Fwww.zero4racer.com%2Fblog%2F577" class="twitter-share-button"  style="width:55px;height:22px;background:transparent url('http://www.zero4racer.com/blog/wp-content/plugins/wp-tweet-button/tweetn.png') no-repeat  0 0;text-align:left;text-indent:-9999px;display:block;">Tweet</a></div><p>あまり一般的な事例ではないですが、Stackoverflowでもはまっている人がいるので備忘に記録しておきます。<br />
NSJSONSerializationクラスで、データをシリアライズすることが出来るのは非常に楽です。しかし私は、CCCryptでデコードしたデータを流してあげると、</p>
<blockquote><p>2012-****** Error Domain=NSCocoaErrorDomain Code=3840 &#8220;The operation couldn’t be completed. (Cocoa error 3840.)&#8221; (Garbage at end.) UserInfo=0x6ccdd40 {NSDebugDescription=Garbage at end.}</p></blockquote>
<p>というエラーが発生して、JSON でシリアライズが出来ませんでした。</p>

<p>こちらを、</p>
<div class="codecolorer-container text mac-classic" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp; &nbsp; NSString* decoded=[request.responseString stringByDecodeFromServer];<br />
&nbsp; &nbsp; decoded=[decoded stringByTrimmingCharactersInSet:[NSCharacterSet controlCharacterSet]];<br />
&nbsp; &nbsp; LOG_S(decoded);<br />
&nbsp; &nbsp; id response =[NSJSONSerialization JSONObjectWithData:[decoded dataUsingEncoding:NSUTF8StringEncoding] options:NSJSONReadingAllowFragments|NSJSONReadingMutableContainers|NSJSONReadingMutableLeaves error:&amp;error];</div></td></tr></tbody></table></div>
<p>のように、Trimしてあげると、うまくシリアライズしてあげる様になりました。</p>
<p>このアイディアをいま、実行しているところです。うまく出来るといいですね。</p>
<blockquote class="twitter-tweet" lang="ja"><p>ツイッター使ったアプリプロモの方法思いついた！ツイッターでアプリについて指定のリンクをつぶやいて、そのアカウントでアプリでログインすれば、アプリ内購入プレゼント(先着何人までも、期間も指定できる！) <a href="http://t.co/AcNTbWqR" title="http://twitter.com/tomohisa/status/190307038973276160/photo/1">twitter.com/tomohisa/statu…</a></p>
<p>&mdash; Tomohisa Takaokaさん (@tomohisa) <a href="https://twitter.com/tomohisa/status/190307038973276160" data-datetime="2012-04-12T05:15:09+00:00">4月 12, 2012</a></p></blockquote>
<p><script src="//platform.twitter.com/widgets.js" charset="utf-8"></script></p>
<blockquote class="twitter-tweet" lang="ja"><p>その２:ツイッター使ったアプリプロモの方法思いついた！ツイッターでアプリについて指定のリンクをつぶやいて、そのアカウントでアプリでログインすれば、アプリ内購入プレゼント(先着何人までも、期間も指定できる！) <a href="http://t.co/2FZsyZPL" title="http://twitter.com/tomohisa/status/190307455748681728/photo/1">twitter.com/tomohisa/statu…</a></p>
<p>&mdash; Tomohisa Takaokaさん (@tomohisa) <a href="https://twitter.com/tomohisa/status/190307455748681728" data-datetime="2012-04-12T05:16:48+00:00">4月 12, 2012</a></p></blockquote>
<p><script src="//platform.twitter.com/widgets.js" charset="utf-8"></script></p>
<div id="tweetbutton577" class="tw_button" style="float:right;margin-left:10px;"><a href="http://twitter.com/share?url=http%3A%2F%2Fwww.zero4racer.com%2Fblog%2F577&amp;via=tomohisa&amp;text=%E3%83%87%E3%82%B3%E3%83%BC%E3%83%89%E3%81%97%E3%81%9FNSData%E3%82%92NSJSONSerialization%E3%82%AF%E3%83%A9%E3%82%B9%E3%81%A7%E8%A7%A3%E6%9E%90%E5%87%BA%E6%9D%A5%E3%81%AA%E3%81%84%E5%A0%B4%E5%90%88%E3%81%AE%E5%AF%BE%E5%87%A6%E6%96%B9%E6%B3%95%20-...%20&amp;related=tomohisa:iPhone+Developer+Tomohisa+Takaoka+at+J-Tech+Creations%2C+Inc.&amp;lang=en&amp;count=horizontal&amp;counturl=http%3A%2F%2Fwww.zero4racer.com%2Fblog%2F577" class="twitter-share-button"  style="width:55px;height:22px;background:transparent url('http://www.zero4racer.com/blog/wp-content/plugins/wp-tweet-button/tweetn.png') no-repeat  0 0;text-align:left;text-indent:-9999px;display:block;">Tweet</a></div>]]></content:encoded>
			<wfw:commentRss>http://www.zero4racer.com/blog/577/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

