<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>IOS on Lantean</title><link>https://www.lantean.co/categories/ios/</link><description>Recent content in IOS on Lantean</description><generator>Hugo</generator><language>en-us</language><lastBuildDate>Sat, 19 May 2018 14:51:23 +0000</lastBuildDate><atom:link href="https://www.lantean.co/categories/ios/index.xml" rel="self" type="application/rss+xml"/><item><title>iOS Simulator Logs</title><link>https://www.lantean.co/posts/ios-simulator-logs/</link><pubDate>Sat, 19 May 2018 14:51:23 +0000</pubDate><guid>https://www.lantean.co/posts/ios-simulator-logs/</guid><description>&lt;p&gt;Leaving this link here&amp;hellip; because&amp;hellip; i kinda always forget the path!&lt;/p&gt;
&lt;blockquote&gt;~/Library/Logs/CoreSimulator/&lt;/blockquote&gt;</description></item><item><title>Swift: Type Casting in For Loop</title><link>https://www.lantean.co/posts/swift-type-casting-in-for-loop/</link><pubDate>Wed, 27 Dec 2017 11:55:30 +0000</pubDate><guid>https://www.lantean.co/posts/swift-type-casting-in-for-loop/</guid><description>&lt;p&gt;Okay. I need to jot this down somewhere, because i find myself googling this snippet, at least once a month.
It&amp;rsquo;s not complex, but for some reason, it&amp;rsquo;s constantly slipping off my mind!&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-objc" data-lang="objc"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;for&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;case&lt;/span&gt; let children as ElementNode &lt;span style="color:#66d9ef"&gt;in&lt;/span&gt; rootNode.children { }&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</description></item><item><title>LLDB + Xcode 8 Kung Fu</title><link>https://www.lantean.co/posts/lldb-xcode-8-kung-fu/</link><pubDate>Tue, 14 Mar 2017 10:34:54 +0000</pubDate><guid>https://www.lantean.co/posts/lldb-xcode-8-kung-fu/</guid><description>&lt;p&gt;&lt;strong&gt;Printing Arrays&lt;/strong&gt;&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-objc" data-lang="objc"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;parray number pointer
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;poarray number pointer&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;strong&gt;Reading Method Parameters&lt;/strong&gt;&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-objc" data-lang="objc"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;register&lt;/span&gt; read &lt;span style="color:#960050;background-color:#1e0010"&gt;$&lt;/span&gt;arg1 &lt;span style="color:#960050;background-color:#1e0010"&gt;$&lt;/span&gt;arg2
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;memory read &lt;span style="color:#960050;background-color:#1e0010"&gt;$&lt;/span&gt;arg1&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;strong&gt;Printing Objects in Swift&lt;/strong&gt;&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-objc" data-lang="objc"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;expr &lt;span style="color:#f92672"&gt;-&lt;/span&gt;O &lt;span style="color:#f92672"&gt;--&lt;/span&gt;language objc &lt;span style="color:#f92672"&gt;--&lt;/span&gt; &lt;span style="color:#ae81ff"&gt;0x1003183e0&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;strong&gt;Disassembling the current frame&lt;/strong&gt;&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-objc" data-lang="objc"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;disassemble &lt;span style="color:#f92672"&gt;--&lt;/span&gt;frame&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;strong&gt;Module Image&lt;/strong&gt;&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-objc" data-lang="objc"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;image list ModuleName&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</description></item><item><title>Fixing Xcode 8's Code Completion</title><link>https://www.lantean.co/posts/fixing-xcode-8s-code-completion/</link><pubDate>Mon, 23 Jan 2017 17:32:41 +0000</pubDate><guid>https://www.lantean.co/posts/fixing-xcode-8s-code-completion/</guid><description>&lt;ul&gt;
&lt;li&gt;Open Preferences &amp;gt; Text Editing&lt;/li&gt;
&lt;li&gt;Uncheck Enable Type-Over Completions&lt;/li&gt;
&lt;li&gt;Be Happy!&lt;/li&gt;
&lt;/ul&gt;</description></item><item><title>Profiling: Swift Compile Time</title><link>https://www.lantean.co/posts/profiling-swift-compile-time/</link><pubDate>Thu, 06 Oct 2016 19:04:00 +0000</pubDate><guid>https://www.lantean.co/posts/profiling-swift-compile-time/</guid><description>&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-objc" data-lang="objc"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;xcodebuild &lt;span style="color:#f92672"&gt;-&lt;/span&gt;scheme TARGET clean build OTHER_SWIFT_FLAGS&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#34;-Xfrontend -debug-time-function-bodies&amp;#34;&lt;/span&gt; &lt;span style="color:#f92672"&gt;|&lt;/span&gt; grep .[&lt;span style="color:#ae81ff"&gt;0&lt;/span&gt;&lt;span style="color:#f92672"&gt;-&lt;/span&gt;&lt;span style="color:#ae81ff"&gt;9&lt;/span&gt;]ms &lt;span style="color:#f92672"&gt;|&lt;/span&gt; grep &lt;span style="color:#f92672"&gt;-&lt;/span&gt;v &lt;span style="color:#f92672"&gt;^&lt;/span&gt;&lt;span style="color:#ae81ff"&gt;0.&lt;/span&gt;[&lt;span style="color:#ae81ff"&gt;0&lt;/span&gt;&lt;span style="color:#f92672"&gt;-&lt;/span&gt;&lt;span style="color:#ae81ff"&gt;9&lt;/span&gt;]ms &lt;span style="color:#f92672"&gt;|&lt;/span&gt; sort &lt;span style="color:#f92672"&gt;-&lt;/span&gt;nr &lt;span style="color:#f92672"&gt;&amp;gt;&lt;/span&gt; culprits.txt&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;a href="http://irace.me/swift-profiling"&gt;Reference Here&lt;/a&gt;&lt;/p&gt;</description></item><item><title>Xcode 8: Disabling Networking Logs</title><link>https://www.lantean.co/posts/xcode-8-disabling-networking-logs/</link><pubDate>Sat, 17 Sep 2016 18:27:25 +0000</pubDate><guid>https://www.lantean.co/posts/xcode-8-disabling-networking-logs/</guid><description>&lt;p&gt;Xcode 8 seems to be printing, for whatever reason, lots and lots of extra debug information.
We can shut it down by means of an environment variable:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-objc" data-lang="objc"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;OS_ACTIVITY_MODE &lt;span style="color:#f92672"&gt;=&lt;/span&gt; disable&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;a href="http://stackoverflow.com/questions/37800790/hide-strange-unwanted-xcode-8-logs/39461256#39461256"&gt;Reference Here&lt;/a&gt;&lt;/p&gt;</description></item><item><title>UITextView + Intrinsic Content Size</title><link>https://www.lantean.co/posts/uitextview-intrinsic-content-size/</link><pubDate>Mon, 29 Aug 2016 11:19:14 +0000</pubDate><guid>https://www.lantean.co/posts/uitextview-intrinsic-content-size/</guid><description>&lt;p&gt;Note to future self: the trick to get intrinsicContentSize to properly work, in UITextView instances, is to simply disable scrolling in the UITextView instance.&lt;/p&gt;
&lt;p&gt;That way&amp;hellip; the intrinsic size will be properly calculated.&lt;/p&gt;</description></item><item><title>Using Xcode 7.x with an iOS 10 Device</title><link>https://www.lantean.co/posts/using-xcode-7-x-with-an-ios-10-device/</link><pubDate>Thu, 16 Jun 2016 16:17:45 +0000</pubDate><guid>https://www.lantean.co/posts/using-xcode-7-x-with-an-ios-10-device/</guid><description>&lt;p&gt;Trick of the month&amp;hellip;.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Upgrade your device to iOS 10&lt;/li&gt;
&lt;li&gt;Install Xcode 8 (Beta)&lt;/li&gt;
&lt;li&gt;Hook up your device and launch Xcode. It&amp;rsquo;ll download debugging symbols.&lt;/li&gt;
&lt;li&gt;Run this command in bash:&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-objc" data-lang="objc"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;sudo ln &lt;span style="color:#f92672"&gt;-&lt;/span&gt;s &lt;span style="color:#f92672"&gt;/&lt;/span&gt;Applications&lt;span style="color:#f92672"&gt;/&lt;/span&gt;Xcode&lt;span style="color:#f92672"&gt;-&lt;/span&gt;beta.app&lt;span style="color:#f92672"&gt;/&lt;/span&gt;Contents&lt;span style="color:#f92672"&gt;/&lt;/span&gt;Developer&lt;span style="color:#f92672"&gt;/&lt;/span&gt;Platforms&lt;span style="color:#f92672"&gt;/&lt;/span&gt;iPhoneOS.platform&lt;span style="color:#f92672"&gt;/&lt;/span&gt;DeviceSupport&lt;span style="color:#f92672"&gt;/&lt;/span&gt;&lt;span style="color:#ae81ff"&gt;10.0&lt;/span&gt;&lt;span style="color:#960050;background-color:#1e0010"&gt;\&lt;/span&gt; (&lt;span style="color:#ae81ff"&gt;14&lt;/span&gt;A5261u) &lt;span style="color:#f92672"&gt;/&lt;/span&gt;Applications&lt;span style="color:#f92672"&gt;/&lt;/span&gt;Xcode.app&lt;span style="color:#f92672"&gt;/&lt;/span&gt;Contents&lt;span style="color:#f92672"&gt;/&lt;/span&gt;Developer&lt;span style="color:#f92672"&gt;/&lt;/span&gt;Platforms&lt;span style="color:#f92672"&gt;/&lt;/span&gt;iPhoneOS.platform&lt;span style="color:#f92672"&gt;/&lt;/span&gt;DeviceSupport&lt;span style="color:#f92672"&gt;/&lt;/span&gt;&lt;span style="color:#ae81ff"&gt;10.0&lt;/span&gt;&lt;span style="color:#960050;background-color:#1e0010"&gt;\&lt;/span&gt; (&lt;span style="color:#ae81ff"&gt;14&lt;/span&gt;A5261u)&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;And now you can use your iOS 10 device with Xcode 7. Phew&lt;/p&gt;</description></item><item><title>ARC: weakSelf Caveats</title><link>https://www.lantean.co/posts/arc-weakself-caveats/</link><pubDate>Mon, 16 Nov 2015 12:13:40 +0000</pubDate><guid>https://www.lantean.co/posts/arc-weakself-caveats/</guid><description>&lt;p&gt;Here&amp;rsquo;s an interesting ARC scenario. Consider the following snippet:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-objc" data-lang="objc"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;__weak&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;__typeof&lt;/span&gt;(self) weakSelf &lt;span style="color:#f92672"&gt;=&lt;/span&gt; self;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;int64_t delay &lt;span style="color:#f92672"&gt;=&lt;/span&gt; (int64_t)(&lt;span style="color:#ae81ff"&gt;0.1&lt;/span&gt; &lt;span style="color:#f92672"&gt;*&lt;/span&gt; NSEC_PER_SEC);
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;dispatch_after(dispatch_time(DISPATCH_TIME_NOW, delay), dispatch_get_main_queue(), &lt;span style="color:#f92672"&gt;^&lt;/span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; [weakSelf doSomething];
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;});&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Whenever the block gets executed&amp;hellip; &lt;em&gt;weakSelf&lt;/em&gt; might have a valid reference, or not. Right?.
Now, what happens with the following snippet?&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-objc" data-lang="objc"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;__weak&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;__typeof&lt;/span&gt;(self) weakSelf &lt;span style="color:#f92672"&gt;=&lt;/span&gt; self;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;int64_t delay &lt;span style="color:#f92672"&gt;=&lt;/span&gt; (int64_t)(&lt;span style="color:#ae81ff"&gt;0.1&lt;/span&gt; &lt;span style="color:#f92672"&gt;*&lt;/span&gt; NSEC_PER_SEC);
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;dispatch_after(dispatch_time(DISPATCH_TIME_NOW, delay), dispatch_get_main_queue(), &lt;span style="color:#f92672"&gt;^&lt;/span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; [weakSelf doSomething];
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; [weakSelf doSomethingElse];
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;});&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;This is where it gets interesting!. There&amp;rsquo;s a possibility that &lt;em&gt;doSomething&lt;/em&gt; might get executed, while &lt;em&gt;doSomethingElse&lt;/em&gt; might not.&lt;/p&gt;</description></item><item><title>Swift: Unit Testing</title><link>https://www.lantean.co/posts/swift-unit-testing/</link><pubDate>Fri, 24 Jul 2015 16:50:49 +0000</pubDate><guid>https://www.lantean.co/posts/swift-unit-testing/</guid><description>&lt;p&gt;I&amp;rsquo;ve recently stumbled upon severe issues, while trying to write a Unit Test, in Swift, that would access Swift Code that belongs to the main app.&lt;/p&gt;
&lt;p&gt;Contrary to what &lt;del datetime="2015-07-24T19:47:54+00:00"&gt;almost&lt;/del&gt; everyone mentions, you should &lt;strong&gt;not import&lt;/strong&gt; the Main App&amp;rsquo;s files into the Testing target.&lt;/p&gt;
&lt;p&gt;Instead, this is what you should do:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Enable &lt;strong&gt;Defines Module&lt;/strong&gt; in the main target.&lt;/li&gt;
&lt;li&gt;Add an &lt;strong&gt;import&lt;/strong&gt; at the top of the Unit Test, to make the main project visible.&lt;/li&gt;
&lt;li&gt;Make sure that the classes to be tested are set to &lt;strong&gt;public&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;a href="http://www.andrewcbancroft.com/2014/12/29/getting-started-unit-testing-swift/"&gt;Reference Here!&lt;/a&gt;&lt;/p&gt;</description></item><item><title>Debugging Autolayout</title><link>https://www.lantean.co/posts/debugging-autolayout/</link><pubDate>Thu, 11 Dec 2014 12:06:37 +0000</pubDate><guid>https://www.lantean.co/posts/debugging-autolayout/</guid><description>&lt;p&gt;If you need to debug the constraints that produced any view layout, just hit LLVM, and type:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-objc" data-lang="objc"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;po [[UIWindow keyWindow] _autolayoutTrace]&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;This will help you get the Autolayout Trace. Pick up the troublesome view, find its memory address, and then try:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-objc" data-lang="objc"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;po [&lt;span style="color:#ae81ff"&gt;0x12341234&lt;/span&gt; constraintsAffectingLayoutForAxis:&lt;span style="color:#ae81ff"&gt;1&lt;/span&gt;]&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Note that you should replace &lt;strong&gt;0x12341234&lt;/strong&gt; with the memory address of the view you&amp;rsquo;d like to debug. AxisX = 0, while AxisY = 1.&lt;/p&gt;
&lt;p&gt;Props to &lt;a href="https://blog.safaribooksonline.com/2012/10/31/tip-ambiguous-auto-layouts-in-ios-6/"&gt;this extremely useful post&lt;/a&gt;.&lt;/p&gt;</description></item><item><title>iOS 8 Autosizing Cells</title><link>https://www.lantean.co/posts/ios-8-autosizing-cells/</link><pubDate>Thu, 11 Dec 2014 09:42:44 +0000</pubDate><guid>https://www.lantean.co/posts/ios-8-autosizing-cells/</guid><description>&lt;p&gt;The latest iOS release (8.0 at the time this was written!) added a new cool feature: autosizing cells. Meaning that we don&amp;rsquo;t really need to implement &lt;strong&gt;tableView:heightForRowAtIndexPath:&lt;/strong&gt; anymore.&lt;/p&gt;
&lt;p&gt;How can we enable this?. Super simple, just add the following snippet:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-objc" data-lang="objc"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;self.tableView.estimatedRowHeight &lt;span style="color:#f92672"&gt;=&lt;/span&gt; SomeConstant;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;self.tableView.rowHeight &lt;span style="color:#f92672"&gt;=&lt;/span&gt; UITableViewAutomaticDimension;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Now, here&amp;rsquo;s the deal. iOS 7 still requires &lt;strong&gt;tableView:heightForRowAtIndexPath:&lt;/strong&gt; to be implemented. And if you do implement it, iOS 8 will disregard the Automatic Dimension settings.&lt;/p&gt;
&lt;p&gt;Solution?.. import &lt;strong&gt;objc/runtime.h&lt;/strong&gt;, and place this hack in your UITableView&amp;rsquo;s delegate:&lt;/p&gt;</description></item><item><title>Fixing: StatusBar covering your UIViewController's view</title><link>https://www.lantean.co/posts/fixing-statusbar-covering-your-uiviewcontrollers-view/</link><pubDate>Fri, 31 Oct 2014 18:52:48 +0000</pubDate><guid>https://www.lantean.co/posts/fixing-statusbar-covering-your-uiviewcontrollers-view/</guid><description>&lt;p&gt;Ever since iOS 7, if you&amp;rsquo;re not using a UINavigationController instance, you&amp;rsquo;ll need to perform a very simple step, in order to prevent iOS&amp;rsquo;s StatusBar from covering your view:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Press Control, click over the &amp;ldquo;Top Layout Guide&amp;rdquo;, and drag it upon the troublesome view.&lt;/li&gt;
&lt;li&gt;You&amp;rsquo;ll get a small popup. Please, click on &amp;ldquo;Vertical Spacing&amp;rdquo;.&lt;/li&gt;
&lt;li&gt;Edit the new constraint, and update the Constant value, as needed.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;a href="https://developer.apple.com/library/ios/qa/qa1797/_index.html"&gt;Reference here!&lt;/a&gt;&lt;/p&gt;</description></item><item><title>CoreData HeavyWeight Migration Issues</title><link>https://www.lantean.co/posts/coredata-heavyweight-migration-gotchas/</link><pubDate>Sat, 25 Oct 2014 10:45:36 +0000</pubDate><guid>https://www.lantean.co/posts/coredata-heavyweight-migration-gotchas/</guid><description>&lt;p&gt;We recently hit a pretty severe bug. In one of our apps, users began experiencing token issues after an upgrade.&lt;/p&gt;
&lt;p&gt;Bottomline?&amp;hellip; the last upgrade had a Heavyweight migration. So far so good, but what happened?. Turns out that the &lt;strong&gt;URIRepresentation&lt;/strong&gt; that can be used to map a &lt;strong&gt;NSManagedObjectID&lt;/strong&gt;, is and is not reliable. Everything is okay, until you perform a heavyweight migration!.&lt;/p&gt;
&lt;p&gt;Heavyweight migrations might swizzle your NSManagedObjectID&amp;rsquo;s. Fix?, create your own &lt;strong&gt;primaryKeys&lt;/strong&gt;. &lt;strong&gt;NSUUID&lt;/strong&gt; helper class is the easiest way to accomplish that.&lt;/p&gt;</description></item><item><title>TextKit + iOS Clipping Bug</title><link>https://www.lantean.co/posts/textkit-ios-clipping-bug/</link><pubDate>Fri, 15 Aug 2014 01:06:15 +0000</pubDate><guid>https://www.lantean.co/posts/textkit-ios-clipping-bug/</guid><description>&lt;p&gt;I&amp;rsquo;ve just spent several hours hunting an iOS 8 specific bug. After inserting several new lines into a UITextView (with custom TextKit stack), the newly-added text would not appear.&lt;/p&gt;
&lt;p&gt;This is the way our NSTextContainer instance was being initialized&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-objc" data-lang="objc"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;@implementation&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;MyTextView&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;- (&lt;span style="color:#66d9ef"&gt;instancetype&lt;/span&gt;)&lt;span style="color:#a6e22e"&gt;init&lt;/span&gt; {
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; SPInteractiveTextStorage &lt;span style="color:#f92672"&gt;*&lt;/span&gt;textStorage &lt;span style="color:#f92672"&gt;=&lt;/span&gt; [[MyInteractiveTextStorage alloc] init];
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; NSLayoutManager &lt;span style="color:#f92672"&gt;*&lt;/span&gt;layoutManager &lt;span style="color:#f92672"&gt;=&lt;/span&gt; [[NSLayoutManager alloc] init];
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; NSTextContainer &lt;span style="color:#f92672"&gt;*&lt;/span&gt;container &lt;span style="color:#f92672"&gt;=&lt;/span&gt; [[NSTextContainer alloc] initWithSize:CGSizeMake(&lt;span style="color:#ae81ff"&gt;0&lt;/span&gt;, CGFLOAT_MAX)];
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; container.widthTracksTextView &lt;span style="color:#f92672"&gt;=&lt;/span&gt; YES;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; container.heightTracksTextView &lt;span style="color:#f92672"&gt;=&lt;/span&gt; YES;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; [layoutManager addTextContainer:container];
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; [textStorage addLayoutManager:layoutManager];
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; self &lt;span style="color:#f92672"&gt;=&lt;/span&gt; [super initWithFrame:CGRectZero textContainer:container];
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#f92672"&gt;//&lt;/span&gt; ...&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Now, the interesting part is, specifically, &lt;strong&gt;heightTracksTextView = YES&lt;/strong&gt;.&lt;/p&gt;</description></item><item><title>Debugging UIKit Usage on BG Threads</title><link>https://www.lantean.co/posts/debugging-uikit-usage-on-bg-threads/</link><pubDate>Thu, 10 Jul 2014 17:08:38 +0000</pubDate><guid>https://www.lantean.co/posts/debugging-uikit-usage-on-bg-threads/</guid><description>&lt;p&gt;Based on &lt;a href="http://www.cocoanetics.com/2013/02/uiview-background-queue-debugging/"&gt;this awesome cocoanetics post&lt;/a&gt;, and updated to work &lt;a href="https://github.com/rentzsch/jrswizzle"&gt;with JRSwizzle&lt;/a&gt;, you might find the UIView+Debug category very handy, specially when debugging die hard bugs.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-objc" data-lang="objc"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;#import &amp;#34;JRSwizzle.h&amp;#34;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;@interface&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;UIView&lt;/span&gt; (Debug)
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;@end&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;@implementation&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;UIView&lt;/span&gt; (Debug)
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;- (&lt;span style="color:#66d9ef"&gt;void&lt;/span&gt;)&lt;span style="color:#a6e22e"&gt;methodCalledNotFromMainQueue:&lt;/span&gt;(NSString &lt;span style="color:#f92672"&gt;*&lt;/span&gt;)methodName
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; NSLog(&lt;span style="color:#e6db74"&gt;@&amp;#34;-[%@ %@] being called on background queue. Break on -[UIView methodCalledNotFromMainQueue:] to find out where&amp;#34;&lt;/span&gt;, NSStringFromClass([self &lt;span style="color:#66d9ef"&gt;class&lt;/span&gt;]), methodName);
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;- (&lt;span style="color:#66d9ef"&gt;void&lt;/span&gt;)&lt;span style="color:#a6e22e"&gt;_setNeedsLayout_MainQueueCheck&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;if&lt;/span&gt; (&lt;span style="color:#f92672"&gt;!&lt;/span&gt;[NSThread isMainThread])
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; {
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; [self methodCalledNotFromMainQueue:NSStringFromSelector(_cmd)];
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; }
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; 
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#75715e"&gt;// not really an endless loop, this calls the original
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; [self _setNeedsLayout_MainQueueCheck];
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;- (&lt;span style="color:#66d9ef"&gt;void&lt;/span&gt;)&lt;span style="color:#a6e22e"&gt;_setNeedsDisplay_MainQueueCheck&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;if&lt;/span&gt; (&lt;span style="color:#f92672"&gt;!&lt;/span&gt;[NSThread isMainThread])
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; {
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; [self methodCalledNotFromMainQueue:NSStringFromSelector(_cmd)];
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; }
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; 
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#75715e"&gt;// not really an endless loop, this calls the original
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; [self _setNeedsDisplay_MainQueueCheck];
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;- (&lt;span style="color:#66d9ef"&gt;void&lt;/span&gt;)&lt;span style="color:#a6e22e"&gt;_setNeedsDisplayInRect_MainQueueCheck:&lt;/span&gt;(CGRect)rect
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;if&lt;/span&gt; (&lt;span style="color:#f92672"&gt;!&lt;/span&gt;[NSThread isMainThread])
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; {
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; [self methodCalledNotFromMainQueue:NSStringFromSelector(_cmd)];
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; }
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; 
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#75715e"&gt;// not really an endless loop, this calls the original
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; [self _setNeedsDisplayInRect_MainQueueCheck:rect];
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;+ (&lt;span style="color:#66d9ef"&gt;void&lt;/span&gt;)&lt;span style="color:#a6e22e"&gt;toggleViewMainQueueChecking&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; NSError &lt;span style="color:#f92672"&gt;*&lt;/span&gt;error &lt;span style="color:#f92672"&gt;=&lt;/span&gt; nil;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; [UIView jr_swizzleMethod:&lt;span style="color:#66d9ef"&gt;@selector&lt;/span&gt;(setNeedsLayout)
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; withMethod:&lt;span style="color:#66d9ef"&gt;@selector&lt;/span&gt;(_setNeedsLayout_MainQueueCheck)
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; error:&lt;span style="color:#f92672"&gt;&amp;amp;&lt;/span&gt;error];
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; 
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; [UIView jr_swizzleMethod:&lt;span style="color:#66d9ef"&gt;@selector&lt;/span&gt;(setNeedsDisplay)
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; withMethod:&lt;span style="color:#66d9ef"&gt;@selector&lt;/span&gt;(_setNeedsDisplay_MainQueueCheck)
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; error:&lt;span style="color:#f92672"&gt;&amp;amp;&lt;/span&gt;error];
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; 
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; [UIView jr_swizzleMethod:&lt;span style="color:#66d9ef"&gt;@selector&lt;/span&gt;(setNeedsDisplayInRect:)
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; withMethod:&lt;span style="color:#66d9ef"&gt;@selector&lt;/span&gt;(_setNeedsDisplayInRect_MainQueueCheck:)
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; error:&lt;span style="color:#f92672"&gt;&amp;amp;&lt;/span&gt;error];
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;@end&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</description></item><item><title>Loading SecCertificateRef from PEM String</title><link>https://www.lantean.co/posts/loading-seccertificateref-from-pem-string/</link><pubDate>Mon, 07 Jul 2014 17:05:49 +0000</pubDate><guid>https://www.lantean.co/posts/loading-seccertificateref-from-pem-string/</guid><description>&lt;p&gt;In order to load a PEM certificate, you&amp;rsquo;d probably wanna grab the PEM itself from your backend, right?.&lt;/p&gt;
&lt;p&gt;You can do so, by means of this command:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-objc" data-lang="objc"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;openssl s_client &lt;span style="color:#f92672"&gt;-&lt;/span&gt;showcerts &lt;span style="color:#f92672"&gt;-&lt;/span&gt;host host.com &lt;span style="color:#f92672"&gt;-&lt;/span&gt;port &lt;span style="color:#ae81ff"&gt;443&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Once you&amp;rsquo;ve got the certificate, you should &lt;strong&gt;get rid of the Begin/End Certificate substrings&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;Cocoa Snippet itself is quite easy:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-objc" data-lang="objc"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;NSData &lt;span style="color:#f92672"&gt;*&lt;/span&gt;rawCertificate &lt;span style="color:#f92672"&gt;=&lt;/span&gt; [[NSData alloc] initWithBase64Encoding:PlaintextCertificateString];
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;SecCertificateRef parsedCertificate &lt;span style="color:#f92672"&gt;=&lt;/span&gt; SecCertificateCreateWithData(NULL, (&lt;span style="color:#66d9ef"&gt;__bridge&lt;/span&gt; CFDataRef)rawCertificate);&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;That&amp;rsquo;s it. Don&amp;rsquo;t forget about checking expiration dates. Unfortunately, Apple&amp;rsquo;s API to do so is private, and i personally refuse to build OpenSSL into my app, just to check that.&lt;/p&gt;</description></item><item><title>Pushing a new CocoaPods Version with Trunk</title><link>https://www.lantean.co/posts/pushing-a-new-cocoapods-version-with-trunk/</link><pubDate>Mon, 30 Jun 2014 12:15:04 +0000</pubDate><guid>https://www.lantean.co/posts/pushing-a-new-cocoapods-version-with-trunk/</guid><description>&lt;p&gt;CocoaPods is a useful dependency management tool for OSX and iOS. They&amp;rsquo;ve recently introduced some changes, to ease the process of publishing new versions of your Framework.&lt;/p&gt;
&lt;p&gt;Just in case you&amp;rsquo;re lost, just like me, these are the commands required to push a new release:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-objc" data-lang="objc"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;pod trunk &lt;span style="color:#66d9ef"&gt;register&lt;/span&gt; EMAIL@HERE.COM &lt;span style="color:#960050;background-color:#1e0010"&gt;&amp;#39;&lt;/span&gt;Your Name&lt;span style="color:#960050;background-color:#1e0010"&gt;&amp;#39;&lt;/span&gt; &lt;span style="color:#f92672"&gt;--&lt;/span&gt;description&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#960050;background-color:#1e0010"&gt;&amp;#39;&lt;/span&gt;MBP &lt;span style="color:#ae81ff"&gt;15&lt;/span&gt;&lt;span style="color:#960050;background-color:#1e0010"&gt;&amp;#39;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;pod trunk me
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;pod trunk push FrameworkName.podspec.json&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Note that after hitting &lt;strong&gt;trunk register&lt;/strong&gt;, you&amp;rsquo;ll get an email to confirm your identity.&lt;/p&gt;</description></item><item><title>Codesign Check</title><link>https://www.lantean.co/posts/codesign-check/</link><pubDate>Thu, 26 Jun 2014 10:38:28 +0000</pubDate><guid>https://www.lantean.co/posts/codesign-check/</guid><description>&lt;p&gt;Keychain access for iOS apps is tied up to the provisioning profile you use to sign the binary. So, what happens if you release a new build, signed using a different provisioning profile?.&lt;/p&gt;
&lt;p&gt;Yes! your guess is accurate!. You loose access to anything you&amp;rsquo;ve stored in the keychain, resulting in (probably) deauthentication.&lt;/p&gt;
&lt;p&gt;There is a command that allows you to verify the &amp;ldquo;Keychain Access Group&amp;rdquo; for a given executable. By means of this, you&amp;rsquo;ll be able to verify if your new release will have the same access than your previous build (assuming you also have that binary!).&lt;/p&gt;</description></item><item><title>Repairing CocoaPods Broken Repository</title><link>https://www.lantean.co/posts/repairing-cocoapods-broken-repository/</link><pubDate>Tue, 04 Feb 2014 16:02:32 +0000</pubDate><guid>https://www.lantean.co/posts/repairing-cocoapods-broken-repository/</guid><description>&lt;p&gt;It seems that CocoaPods fellows had an &lt;a href="http://blog.cocoapods.org/Repairing-Our-Broken-Specs-Repository/"&gt;issue with libgit&lt;/a&gt;, and their public repository broke down.&lt;/p&gt;
&lt;p&gt;In order to fix it, you&amp;rsquo;ll need to&amp;hellip;.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-objc" data-lang="objc"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;pod repo remove master
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;pod setup&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</description></item><item><title>Generating a Mac Iconset</title><link>https://www.lantean.co/posts/generating-a-mac-iconset/</link><pubDate>Wed, 24 Jul 2013 21:06:24 +0000</pubDate><guid>https://www.lantean.co/posts/generating-a-mac-iconset/</guid><description>&lt;p&gt;You&amp;rsquo;ll need to create PNG assets with the following sizes and filenames:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-objc" data-lang="objc"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;icon_16x16.png
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;icon_16x16&lt;span style="color:#ae81ff"&gt;@2&lt;/span&gt;x.png
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;icon_32x32.png
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;icon_32x32&lt;span style="color:#ae81ff"&gt;@2&lt;/span&gt;x.png
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;icon_128x128.png
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;icon_128x128&lt;span style="color:#ae81ff"&gt;@2&lt;/span&gt;x.png
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;icon_256x256.png
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;icon_256x256&lt;span style="color:#ae81ff"&gt;@2&lt;/span&gt;x.png
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;icon_512x512.png
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;icon_512x512&lt;span style="color:#ae81ff"&gt;@2&lt;/span&gt;x.png&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;All of those assets should go into a folder named &amp;lsquo;Icon.iconset&amp;rsquo;.
Afterwards, just fire Terminal and type the following command:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-objc" data-lang="objc"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;iconutil &lt;span style="color:#f92672"&gt;-&lt;/span&gt;c icns&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;If all went well, you should have a .icns file right there!.&lt;/p&gt;
&lt;p&gt;Reference: &lt;a href="https://developer.apple.com/library/mac/#documentation/GraphicsAnimation/Conceptual/HighResolutionOSX/Optimizing/Optimizing.html"&gt;Apple&amp;rsquo;s Guidelines&lt;/a&gt;.&lt;/p&gt;</description></item><item><title>Waiting until two async blocks are executed (Version #2)</title><link>https://www.lantean.co/posts/waiting-until-two-async-blocks-are-executed-version-2/</link><pubDate>Wed, 26 Jun 2013 15:58:10 +0000</pubDate><guid>https://www.lantean.co/posts/waiting-until-two-async-blocks-are-executed-version-2/</guid><description>&lt;p&gt;This is a nice variant to &lt;a href="https://www.lantean.co/waiting-until-two-async-blocks-are-executed/"&gt;this&lt;/a&gt; other post. It gives you&amp;hellip; way too much flexibility!&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-objc" data-lang="objc"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;dispatch_group_t group &lt;span style="color:#f92672"&gt;=&lt;/span&gt; dispatch_group_create();
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;dispatch_group_enter(group);
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, &lt;span style="color:#ae81ff"&gt;0&lt;/span&gt;), &lt;span style="color:#f92672"&gt;^&lt;/span&gt; {
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; NSLog(&lt;span style="color:#e6db74"&gt;@&amp;#34;Block1&amp;#34;&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; [NSThread sleepForTimeInterval:&lt;span style="color:#ae81ff"&gt;5.0&lt;/span&gt;];
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; dispatch_group_leave(group);
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; NSLog(&lt;span style="color:#e6db74"&gt;@&amp;#34;Block1 End&amp;#34;&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;});
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;dispatch_group_enter(group);
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, &lt;span style="color:#ae81ff"&gt;0&lt;/span&gt;), &lt;span style="color:#f92672"&gt;^&lt;/span&gt; {
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; NSLog(&lt;span style="color:#e6db74"&gt;@&amp;#34;Block2&amp;#34;&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; [NSThread sleepForTimeInterval:&lt;span style="color:#ae81ff"&gt;8.0&lt;/span&gt;];
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; dispatch_group_leave(group);
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; NSLog(&lt;span style="color:#e6db74"&gt;@&amp;#34;Block2 End&amp;#34;&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;});
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;dispatch_group_notify(group, dispatch_get_main_queue(), &lt;span style="color:#f92672"&gt;^&lt;/span&gt; {
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; NSLog(&lt;span style="color:#e6db74"&gt;@&amp;#34;Group Notify Block3 :: %d&amp;#34;&lt;/span&gt;, [NSThread isMainThread]);
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;});&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</description></item><item><title>Waiting until two async blocks are executed</title><link>https://www.lantean.co/posts/waiting-until-two-async-blocks-are-executed/</link><pubDate>Tue, 09 Apr 2013 22:42:33 +0000</pubDate><guid>https://www.lantean.co/posts/waiting-until-two-async-blocks-are-executed/</guid><description>&lt;p&gt;The following snippet of code.. which is super interesting, is based on &lt;a href="http://stackoverflow.com/questions/11909629/waiting-until-two-async-blocks-are-executed-before-starting-another-block"&gt;this&lt;/a&gt; post. This allows to dispatch a block, on Main Thread, once two async operations are completed.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-objc" data-lang="objc"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;dispatch_group_t group &lt;span style="color:#f92672"&gt;=&lt;/span&gt; dispatch_group_create();
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;dispatch_group_async(group, dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, &lt;span style="color:#ae81ff"&gt;0&lt;/span&gt;), &lt;span style="color:#f92672"&gt;^&lt;/span&gt; {
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; NSLog(&lt;span style="color:#e6db74"&gt;@&amp;#34;Block1&amp;#34;&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; [NSThread sleepForTimeInterval:&lt;span style="color:#ae81ff"&gt;5.0&lt;/span&gt;];
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; NSLog(&lt;span style="color:#e6db74"&gt;@&amp;#34;Block1 End&amp;#34;&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;});
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;dispatch_group_async(group, dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, &lt;span style="color:#ae81ff"&gt;0&lt;/span&gt;), &lt;span style="color:#f92672"&gt;^&lt;/span&gt; {
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; NSLog(&lt;span style="color:#e6db74"&gt;@&amp;#34;Block2&amp;#34;&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; [NSThread sleepForTimeInterval:&lt;span style="color:#ae81ff"&gt;8.0&lt;/span&gt;];
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; NSLog(&lt;span style="color:#e6db74"&gt;@&amp;#34;Block2 End&amp;#34;&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;});
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;dispatch_group_notify(group, dispatch_get_main_queue(), &lt;span style="color:#f92672"&gt;^&lt;/span&gt; {
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; NSLog(&lt;span style="color:#e6db74"&gt;@&amp;#34;Block3 :: %d&amp;#34;&lt;/span&gt;, [NSThread isMainThread]);
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;});
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;dispatch_release(group);&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</description></item><item><title>New iPhone Jailbreak Released</title><link>https://www.lantean.co/posts/iphone-jailbreak/</link><pubDate>Wed, 06 Feb 2013 21:52:30 +0000</pubDate><guid>https://www.lantean.co/posts/iphone-jailbreak/</guid><description>&lt;p style="text-align: left;"&gt;It's been a while since the last iPhone jailbreak was made public. But all evil comes to an end, sooner rather than later. A couple days ago, a hacking group named evad3rs, published a brand new Jailbreak tool for iOS 6.x.&lt;/p&gt;
&lt;p&gt;It&amp;rsquo;s claimed to be able to jailbreak any iOS device: iPod / iPad / iPhone / iPad Mini. I&amp;rsquo;ve tested it myself on two devices: iPhone 4s and iPhone 5. The results were impressive. They managed to combine at least 3 different exploits to make things work.&lt;/p&gt;</description></item><item><title>Checking the UUID of a DSYM file</title><link>https://www.lantean.co/posts/checking-the-uuid-of-a-dsym-file/</link><pubDate>Tue, 05 Feb 2013 12:43:35 +0000</pubDate><guid>https://www.lantean.co/posts/checking-the-uuid-of-a-dsym-file/</guid><description>&lt;p&gt;So&amp;hellip; you&amp;rsquo;ve got a crashlog, and you don&amp;rsquo;t know if a given DSYM actually matches with the original executable?. Well, there is a super easy way to verify this. Simply type the following, in your console:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-objc" data-lang="objc"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;dwarfdump &lt;span style="color:#f92672"&gt;-&lt;/span&gt;u Project.app.dSYM&lt;span style="color:#f92672"&gt;/&lt;/span&gt;Contents&lt;span style="color:#f92672"&gt;/&lt;/span&gt;Resources&lt;span style="color:#f92672"&gt;/&lt;/span&gt;DWARF&lt;span style="color:#f92672"&gt;/&lt;/span&gt;Project&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Ideally, mdfind should help you locate the matching DWARF. But sometimes&amp;hellip; symbolication requires extra debugging.&lt;/p&gt;</description></item><item><title>Xcode 4.6 Released!</title><link>https://www.lantean.co/posts/xcode-4-6-released/</link><pubDate>Tue, 29 Jan 2013 20:47:08 +0000</pubDate><guid>https://www.lantean.co/posts/xcode-4-6-released/</guid><description>&lt;p&gt;Head your browsers to &lt;a title="Apple Development Center" href="http://developer.apple.com"&gt;Apple&amp;rsquo;s Development Center&lt;/a&gt;. Apple has just released Xcode 4.6, with iOS 6.1 support (Release!).&lt;/p&gt;
&lt;p&gt;So far it has proven to be sooooo much stable. The previous release was a nightmare, specially during summertime. (Those of you who run Xcode on macbooks understand me&amp;hellip; the entire machine turns into an iron!).&lt;/p&gt;
&lt;p&gt;However, i&amp;rsquo;ve been reading quite a lot of reports, from many different sources, pointing out that although 4.6 &lt;em&gt;freezes less&lt;/em&gt;, it still has a couple of severe bugs, that will lower your productivity.&lt;/p&gt;</description></item><item><title>Fixing 'Could Not Read from Device' Xcode Error</title><link>https://www.lantean.co/posts/fixing-could-not-read-from-device-xcode-error/</link><pubDate>Mon, 28 Jan 2013 15:04:51 +0000</pubDate><guid>https://www.lantean.co/posts/fixing-could-not-read-from-device-xcode-error/</guid><description>&lt;p&gt;Did you just get this error while trying to run your app in Xcode?&amp;hellip;&lt;/p&gt;
&lt;p style="text-align: center;"&gt;&lt;a href="https://www.lantean.co/wp-content/uploads/2013/01/could-not-read-from-device.png"&gt;&lt;img class="aligncenter size-full wp-image-775" title="Could not read from device" alt="Could not read from device" src="https://www.lantean.co/wp-content/uploads/2013/01/could-not-read-from-device.png" width="411" height="126" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;The fix is fairly simple. Simply launch iTunes, make sure the device is plugged in, and synchronize. The error should be gone by now.&lt;/p&gt;
&lt;p&gt;Told you, it was a quick fix!&lt;/p&gt;</description></item><item><title>Knowing Memory Usage in iOS</title><link>https://www.lantean.co/posts/knowing-memory-usage-in-ios/</link><pubDate>Mon, 28 Jan 2013 14:55:41 +0000</pubDate><guid>https://www.lantean.co/posts/knowing-memory-usage-in-ios/</guid><description>&lt;p&gt;This task is quite straightforward. First, import the following headers:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-objc" data-lang="objc"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;#import &amp;lt;mach/mach.h&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;#import &amp;lt;mach/mach_host.h&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Now what?. Simple&amp;hellip; use this method:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-objc" data-lang="objc"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;-(&lt;span style="color:#66d9ef"&gt;void&lt;/span&gt;)&lt;span style="color:#a6e22e"&gt;printMemoryUsage&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; mach_port_t host_port;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; mach_msg_type_number_t host_size;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; vm_size_t pagesize;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; host_port &lt;span style="color:#f92672"&gt;=&lt;/span&gt; mach_host_self();
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; host_size &lt;span style="color:#f92672"&gt;=&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;sizeof&lt;/span&gt;(vm_statistics_data_t) &lt;span style="color:#f92672"&gt;/&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;sizeof&lt;/span&gt;(integer_t);
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; host_page_size(host_port, &lt;span style="color:#f92672"&gt;&amp;amp;&lt;/span&gt;pagesize);
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; vm_statistics_data_t vm_stat;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;if&lt;/span&gt; (host_statistics(host_port, HOST_VM_INFO, (host_info_t)&lt;span style="color:#f92672"&gt;&amp;amp;&lt;/span&gt;vm_stat, &lt;span style="color:#f92672"&gt;&amp;amp;&lt;/span&gt;host_size) &lt;span style="color:#f92672"&gt;!=&lt;/span&gt; KERN_SUCCESS)
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; {
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; NSLog(&lt;span style="color:#e6db74"&gt;@&amp;#34;Failed to fetch vm statistics&amp;#34;&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; }
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#75715e"&gt;/* Stats in bytes */&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; natural_t mem_used &lt;span style="color:#f92672"&gt;=&lt;/span&gt; (vm_stat.active_count &lt;span style="color:#f92672"&gt;+&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; vm_stat.inactive_count &lt;span style="color:#f92672"&gt;+&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; vm_stat.wire_count) &lt;span style="color:#f92672"&gt;*&lt;/span&gt; pagesize;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; natural_t mem_free &lt;span style="color:#f92672"&gt;=&lt;/span&gt; vm_stat.free_count &lt;span style="color:#f92672"&gt;*&lt;/span&gt; pagesize;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; natural_t mem_total &lt;span style="color:#f92672"&gt;=&lt;/span&gt; mem_used &lt;span style="color:#f92672"&gt;+&lt;/span&gt; mem_free;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; NSLog(&lt;span style="color:#e6db74"&gt;@&amp;#34;used: %u free: %u total: %u&amp;#34;&lt;/span&gt;, mem_used, mem_free, mem_total);
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Credits: This is a snippet taken &lt;a href="http://stackoverflow.com/questions/5012886/knowing-available-ram-on-an-ios-device"&gt;from&lt;/a&gt; this Stackoverflow question.&lt;/p&gt;</description></item><item><title>Free iPhone MAME Emulator</title><link>https://www.lantean.co/posts/free-iphone-mame-emulator/</link><pubDate>Sun, 27 Jan 2013 11:35:22 +0000</pubDate><guid>https://www.lantean.co/posts/free-iphone-mame-emulator/</guid><description>&lt;p style="text-align: center;"&gt;&lt;a href="https://www.lantean.co/wp-content/uploads/2013/01/iPhone-mame.png"&gt;&lt;img class="aligncenter size-medium wp-image-763" title="iPhone mame" alt="iPhone mame" src="https://www.lantean.co/wp-content/uploads/2013/01/iPhone-mame.png" width="300" height="172" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;From time to time, Apple&amp;rsquo;s Review Team, for whatever reason, allows Apps that clearly violate the AppStore guidelines.&lt;/p&gt;
&lt;p&gt;This time, &lt;a title="iPhone Mame Emulator" href="https://itunes.apple.com/us/app/gridlee/id595117070?mt=8&amp;amp;ign-mpt=uo%3D4"&gt;Gridlee&lt;/a&gt; managed to got in. It&amp;rsquo;s free, and it&amp;rsquo;s somewhere around 85 megabytes. You can expect it to be removed sooner rather than later&amp;hellip; so my recommendation would be&amp;hellip; go and get it!.&lt;/p&gt;
&lt;p&gt;You can install any ROMs you might have already downloaded. Playing Choplifter on an iPad Retina isn&amp;rsquo;t hi-tech, but i&amp;rsquo;ve always said, old school games are the best. You don&amp;rsquo;t need complex 3d algorithms, shadows, or near-perfect water effects to have fun.&lt;/p&gt;</description></item><item><title>New iPhone Jailbreak!</title><link>https://www.lantean.co/posts/new-iphone-jailbreak/</link><pubDate>Sun, 27 Jan 2013 11:26:43 +0000</pubDate><guid>https://www.lantean.co/posts/new-iphone-jailbreak/</guid><description>&lt;p&gt;&lt;a href="https://www.lantean.co/wp-content/uploads/2013/01/iphone-jailbreak.jpg"&gt;&lt;img class="aligncenter size-full wp-image-760" alt="iphone-jailbreak" src="https://www.lantean.co/wp-content/uploads/2013/01/iphone-jailbreak.jpg" width="600" height="512" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Today, a new iPhone Jailbreak solution, has been announced to be already on its way. iOS 6.0 and 6.1 beta 4 have been both jailbroken, and the team is waiting for iOS 6.1 final release to launch the goodies!.&lt;/p&gt;
&lt;p&gt;If you have a previous iOS version, and you still wanna jailbreak your device, you should head to &lt;a href="http://www.jailbreakmatrix.com/" rel="nofollow"&gt;this&lt;/a&gt; site. They have a nice archive of every JB solution that got released.&lt;/p&gt;</description></item><item><title>Top 5 iPhone Games</title><link>https://www.lantean.co/posts/top-5-iphone-games/</link><pubDate>Fri, 25 Jan 2013 21:58:23 +0000</pubDate><guid>https://www.lantean.co/posts/top-5-iphone-games/</guid><description>&lt;p&gt;Do you usually spend time waiting for a bus&amp;hellip; without anything to do?. And how about when there is nothing on TV? what do you do?. Or&amp;hellip; say&amp;hellip; you&amp;rsquo;ve just finished that book you&amp;rsquo;ve been reading for months, and you have no clue what to do with your spare time!.&lt;/p&gt;
&lt;p&gt;If you answer &amp;lsquo;yes&amp;rsquo; to any of the above questions, then this short list of Top 5 iPhone Games is just for you!.&lt;/p&gt;</description></item><item><title>Using NSLocalizedString with a dictionary stored inside a bundle</title><link>https://www.lantean.co/posts/using-nslocalizedstring-with-a-dictionary-stored-inside-a-bundle/</link><pubDate>Wed, 16 Jan 2013 20:29:52 +0000</pubDate><guid>https://www.lantean.co/posts/using-nslocalizedstring-with-a-dictionary-stored-inside-a-bundle/</guid><description>&lt;p&gt;We&amp;rsquo;ve seen before &lt;a title="Making an iOS Assets Bundle" href="https://www.lantean.co/making-an-ios-assets-bundle/"&gt;how to create an iOS Assets bundle&lt;/a&gt;. Today, we&amp;rsquo;ll try to localize a string, using a dictionary stored in a bundle. In order to do so&amp;hellip; we&amp;rsquo;ll rely on the following helper method:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-objc" data-lang="objc"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;@interface&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;LABundles&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;+ (NSBundle&lt;span style="color:#f92672"&gt;*&lt;/span&gt;)&lt;span style="color:#a6e22e"&gt;someResourcesLocalizationBundle&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;@end&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;@implementation&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;LABundles&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;+ (NSBundle&lt;span style="color:#f92672"&gt;*&lt;/span&gt;)&lt;span style="color:#a6e22e"&gt;someResourcesLocalizationBundle&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;	&lt;span style="color:#66d9ef"&gt;static&lt;/span&gt; NSBundle&lt;span style="color:#f92672"&gt;*&lt;/span&gt; someResourcesLocalizationBundle &lt;span style="color:#f92672"&gt;=&lt;/span&gt; nil;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;	&lt;span style="color:#66d9ef"&gt;if&lt;/span&gt; ( someResourcesLocalizationBundle &lt;span style="color:#f92672"&gt;==&lt;/span&gt; nil )
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;	{
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;	 &lt;span style="color:#75715e"&gt;// This double check increases efficiency. Don&amp;#39;t you get bored of asking the same thing twice?.
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;@synchronized&lt;/span&gt;(self)
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; {
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;if&lt;/span&gt; ( someResourcesLocalizationBundle &lt;span style="color:#f92672"&gt;==&lt;/span&gt; nil )
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; {
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;	 &lt;span style="color:#75715e"&gt;// Figure out the current language.
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; 		NSUserDefaults&lt;span style="color:#f92672"&gt;*&lt;/span&gt; defs &lt;span style="color:#f92672"&gt;=&lt;/span&gt; [NSUserDefaults standardUserDefaults];
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; NSArray&lt;span style="color:#f92672"&gt;*&lt;/span&gt; languages &lt;span style="color:#f92672"&gt;=&lt;/span&gt; [defs objectForKey:&lt;span style="color:#e6db74"&gt;@&amp;#34;AppleLanguages&amp;#34;&lt;/span&gt;];
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; NSString&lt;span style="color:#f92672"&gt;*&lt;/span&gt; currentLanguage &lt;span style="color:#f92672"&gt;=&lt;/span&gt; [languages objectAtIndex:&lt;span style="color:#ae81ff"&gt;0&lt;/span&gt;];
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;	 &lt;span style="color:#75715e"&gt;// Map the current language&amp;#39;s folder within the bundle
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; NSBundle&lt;span style="color:#f92672"&gt;*&lt;/span&gt; bundle &lt;span style="color:#f92672"&gt;=&lt;/span&gt; [NSBundle someResourcesBundle];
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; NSString&lt;span style="color:#f92672"&gt;*&lt;/span&gt; path &lt;span style="color:#f92672"&gt;=&lt;/span&gt; [bundle pathForResource:currentLanguage ofType:&lt;span style="color:#e6db74"&gt;@&amp;#34;lproj&amp;#34;&lt;/span&gt;];
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;	 &lt;span style="color:#75715e"&gt;// Okay, let&amp;#39;s go with the default bundle
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;if&lt;/span&gt; ( path &lt;span style="color:#f92672"&gt;==&lt;/span&gt; nil )
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; {
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; someResourcesLocalizationBundle &lt;span style="color:#f92672"&gt;=&lt;/span&gt; bundle;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; }
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;	 &lt;span style="color:#75715e"&gt;// Bingo!
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;else&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; {
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; someResourcesLocalizationBundle &lt;span style="color:#f92672"&gt;=&lt;/span&gt; [NSBundle bundleWithPath:path];
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; }
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; [someResourcesLocalizationBundle &lt;span style="color:#66d9ef"&gt;retain&lt;/span&gt;];
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; }
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; }
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;	}
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;return&lt;/span&gt; someResourcesLocalizationBundle;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;@end&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt; 
What&amp;rsquo;s that all about?. Well&amp;hellip; it turns out that order to resolve localized strings, first of all we need to figure out what&amp;rsquo;s the device&amp;rsquo;s language.&lt;/p&gt;</description></item><item><title>Loading UIImages from files stored inside a bundle</title><link>https://www.lantean.co/posts/loading-uiimages-from-files-stored-inside-a-bundle/</link><pubDate>Wed, 16 Jan 2013 20:28:45 +0000</pubDate><guid>https://www.lantean.co/posts/loading-uiimages-from-files-stored-inside-a-bundle/</guid><description>&lt;p&gt;We&amp;rsquo;ve learnt before &lt;a title="Making an iOS Assets Bundle" href="https://www.lantean.co/making-an-ios-assets-bundle/"&gt;how to make an iOS Assets Bundle&lt;/a&gt;. In this mini post&amp;hellip; we&amp;rsquo;ll learn how to learn images, stored in bundles. Okay.. this one is super simple:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-objc" data-lang="objc"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;UIImage&lt;span style="color:#f92672"&gt;*&lt;/span&gt; twitterBtnImage &lt;span style="color:#f92672"&gt;=&lt;/span&gt; [UIImage imageNamed:&lt;span style="color:#e6db74"&gt;@&amp;#34;SomeResources.bundle/twitter-button.png&amp;#34;&lt;/span&gt;];&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Of course, you need to have the &amp;lsquo;SomeResources&amp;rsquo; bundle in your project. That&amp;rsquo;s it!&lt;/p&gt;</description></item><item><title>Loading NIBs stored inside a bundle</title><link>https://www.lantean.co/posts/loading-nibs-stored-inside-a-bundle/</link><pubDate>Wed, 16 Jan 2013 20:27:07 +0000</pubDate><guid>https://www.lantean.co/posts/loading-nibs-stored-inside-a-bundle/</guid><description>&lt;p&gt;When does it make sense to store your NIBs inside a bundle?. As we&amp;rsquo;ve discussed &lt;a title="Making an iOS Assets Bundle" href="https://www.lantean.co/making-an-ios-assets-bundle/"&gt;before&lt;/a&gt;&amp;hellip; this becomes handy when you&amp;rsquo;re distributing a framework which has some custom NIB files.&lt;/p&gt;
&lt;p&gt;But wait&amp;hellip;. how do you tell a UIViewController to load its nib file from a bundle?. Short answer&amp;hellip; we&amp;rsquo;ll rely on UIViewController&amp;rsquo;s &amp;lsquo;initWithNibName: bundle:&amp;rsquo; constructor.&lt;/p&gt;
&lt;p&gt;Before doing that&amp;hellip; we need to take care about a small detail, which is, how to load a NSBundle object (to pass on as the &amp;lsquo;bundle&amp;rsquo; parameter).&lt;/p&gt;</description></item><item><title>Making an iOS Assets Bundle</title><link>https://www.lantean.co/posts/making-an-ios-assets-bundle/</link><pubDate>Wed, 16 Jan 2013 20:16:41 +0000</pubDate><guid>https://www.lantean.co/posts/making-an-ios-assets-bundle/</guid><description>&lt;p&gt;An iOS Bundle is just a folder which contains resources. Roughly speaking,  it allows you to store any resource you might need: images, nibs, or localized string files.&lt;/p&gt;
&lt;p&gt;Why would you create an application bundle?. What&amp;rsquo;s that good for?.&lt;/p&gt;
&lt;p&gt;Suppose you have a framework of your own. And&amp;hellip; suppose that your framework has several UIViewController which require custom images. OR, suppose that you need to load different images dynamically, within your framework&amp;rsquo;s code.&lt;/p&gt;</description></item><item><title>Manually Symbolicating iOS Crashlogs</title><link>https://www.lantean.co/posts/manually-symbolicating-ios-crashlogs/</link><pubDate>Wed, 16 Jan 2013 19:39:23 +0000</pubDate><guid>https://www.lantean.co/posts/manually-symbolicating-ios-crashlogs/</guid><description>&lt;p&gt;I&amp;rsquo;ve been facing this problem for as long as i&amp;rsquo;ve been developing iOS apps. What&amp;rsquo;s the deal with crashlogs????&amp;hellip;..&lt;/p&gt;
&lt;p&gt;Apple allows you to download crashlogs through iTunesConnect. What are crashlogs you may say. Well, crashlogs are simply text files that allows us to debug crashes. You get to see the Stack Dump at the moment of the crash, as well as the architecture, and loaded libraries.&lt;/p&gt;
&lt;p&gt;What is symbolication??&amp;hellip; well, the crashes you download in iTunesConnect aren&amp;rsquo;t useful, unless you&amp;rsquo;ve got the dSYM file matching that crashlog. If you do, you&amp;rsquo;ll be able to symbolicate it. That means that&amp;hellip; instead of seeing memory addresses in the stack dump, you&amp;rsquo;ll get to see method and class names.&lt;/p&gt;</description></item><item><title>Adding support for iPhone 5 screens</title><link>https://www.lantean.co/posts/adding-support-for-iphone-5-screens/</link><pubDate>Wed, 16 Jan 2013 18:18:20 +0000</pubDate><guid>https://www.lantean.co/posts/adding-support-for-iphone-5-screens/</guid><description>&lt;p&gt;Not long ago, i had to extend an app to support iPhone 5. Yes&amp;hellip; iOS has autolayout functionality, that should aid the development of UIView&amp;rsquo;s.&lt;/p&gt;
&lt;p&gt;But how about assets?. How do you load assets specially crafted for 568px height screens?. Furthermore.. how do you patch classes that inherit from UITableViewCell, to return dynamic height, according to the device?.&lt;/p&gt;
&lt;p&gt;Simple!. By means of a super short UIScreen extension. The header should look like this&amp;hellip;:&lt;/p&gt;</description></item><item><title>Calculating NSData's MD5</title><link>https://www.lantean.co/posts/calculating-nsdatas-md5/</link><pubDate>Wed, 16 Jan 2013 14:26:21 +0000</pubDate><guid>https://www.lantean.co/posts/calculating-nsdatas-md5/</guid><description>&lt;p&gt;Suppose that you need to calculate a NSData&amp;rsquo;s MD5 signature.. for whatever reason. Say&amp;hellip; you need to check the backend&amp;rsquo;s signature.&lt;/p&gt;
&lt;p&gt;Well&amp;hellip; simply add a NSData extension, with the following method:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-objc" data-lang="objc"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;- (NSString&lt;span style="color:#f92672"&gt;*&lt;/span&gt;)&lt;span style="color:#a6e22e"&gt;md5&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;unsigned&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;char&lt;/span&gt; result[&lt;span style="color:#ae81ff"&gt;16&lt;/span&gt;];
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; CC_MD5( self.bytes, self.length, result ); &lt;span style="color:#75715e"&gt;// This is the md5 call
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;return&lt;/span&gt; [NSString stringWithFormat:&lt;span style="color:#e6db74"&gt;@&amp;#34;%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x&amp;#34;&lt;/span&gt;,
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; result[&lt;span style="color:#ae81ff"&gt;0&lt;/span&gt;], result[&lt;span style="color:#ae81ff"&gt;1&lt;/span&gt;], result[&lt;span style="color:#ae81ff"&gt;2&lt;/span&gt;], result[&lt;span style="color:#ae81ff"&gt;3&lt;/span&gt;], 
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; result[&lt;span style="color:#ae81ff"&gt;4&lt;/span&gt;], result[&lt;span style="color:#ae81ff"&gt;5&lt;/span&gt;], result[&lt;span style="color:#ae81ff"&gt;6&lt;/span&gt;], result[&lt;span style="color:#ae81ff"&gt;7&lt;/span&gt;],
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; result[&lt;span style="color:#ae81ff"&gt;8&lt;/span&gt;], result[&lt;span style="color:#ae81ff"&gt;9&lt;/span&gt;], result[&lt;span style="color:#ae81ff"&gt;10&lt;/span&gt;], result[&lt;span style="color:#ae81ff"&gt;11&lt;/span&gt;],
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; result[&lt;span style="color:#ae81ff"&gt;12&lt;/span&gt;], result[&lt;span style="color:#ae81ff"&gt;13&lt;/span&gt;], result[&lt;span style="color:#ae81ff"&gt;14&lt;/span&gt;], result[&lt;span style="color:#ae81ff"&gt;15&lt;/span&gt;]
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; ]; 
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Again, please, don&amp;rsquo;t you forget the imports!&lt;/p&gt;</description></item><item><title>Encrypting and Decrypting NSData with AES256</title><link>https://www.lantean.co/posts/encrypting-and-decrypting-nsdata-with-aes256/</link><pubDate>Wed, 16 Jan 2013 14:24:09 +0000</pubDate><guid>https://www.lantean.co/posts/encrypting-and-decrypting-nsdata-with-aes256/</guid><description>&lt;p&gt;Today we&amp;rsquo;re gonna encrypt information, stored in a NSData object, using AES-256 algorithm. As you may already know, AES-256 is a symmetric encryption schema. Which means that you need to share, somehow, the key you&amp;rsquo;re gonna use (in order to decrypt the data).&lt;/p&gt;
&lt;p&gt;I&amp;rsquo;ve encapsulated a couple helper methods, as a NSData extension, for the sake of simplicity. I&amp;rsquo;ve based myself on &lt;a href="http://stackoverflow.com/questions/6527761/aes-with-commoncrypto-uses-too-much-memory-objective-c" rel="nofollow"&gt;this&lt;/a&gt;. Let&amp;rsquo;s see&amp;hellip;&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-objc" data-lang="objc"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;- (NSData&lt;span style="color:#f92672"&gt;*&lt;/span&gt;)&lt;span style="color:#a6e22e"&gt;aes256EncryptWithKey:&lt;/span&gt;(NSString&lt;span style="color:#f92672"&gt;*&lt;/span&gt;)key
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#75715e"&gt;// &amp;#39;key&amp;#39; should be 32 bytes for AES256, will be null-padded otherwise
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;char&lt;/span&gt; keyPtr[kCCKeySizeAES256 &lt;span style="color:#f92672"&gt;+&lt;/span&gt; &lt;span style="color:#ae81ff"&gt;1&lt;/span&gt;];
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; bzero( keyPtr, &lt;span style="color:#66d9ef"&gt;sizeof&lt;/span&gt;( keyPtr ) );
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#75715e"&gt;// fetch key data
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; [key getCString:keyPtr maxLength:&lt;span style="color:#66d9ef"&gt;sizeof&lt;/span&gt;( keyPtr ) encoding:NSUTF8StringEncoding];
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; NSUInteger dataLength &lt;span style="color:#f92672"&gt;=&lt;/span&gt; [self length];
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#75715e"&gt;// See the doc: For block ciphers, the output size will always be less than or equal to the input size plus the size of one block.
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#75715e"&gt;// That&amp;#39;s why we need to add the size of one block here
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; size_t bufferSize &lt;span style="color:#f92672"&gt;=&lt;/span&gt; dataLength &lt;span style="color:#f92672"&gt;+&lt;/span&gt; kCCBlockSizeAES128;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;void&lt;/span&gt; &lt;span style="color:#f92672"&gt;*&lt;/span&gt;buffer &lt;span style="color:#f92672"&gt;=&lt;/span&gt; malloc( bufferSize );
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; size_t numBytesEncrypted &lt;span style="color:#f92672"&gt;=&lt;/span&gt; &lt;span style="color:#ae81ff"&gt;0&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; CCCryptorStatus cryptStatus &lt;span style="color:#f92672"&gt;=&lt;/span&gt; CCCrypt( kCCEncrypt, kCCAlgorithmAES128, kCCOptionPKCS7Padding,
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; keyPtr, kCCKeySizeAES256,
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; NULL &lt;span style="color:#75715e"&gt;/* initialization vector (optional) */&lt;/span&gt;,
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; [self bytes], dataLength, &lt;span style="color:#75715e"&gt;/* input */&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; buffer, bufferSize, &lt;span style="color:#75715e"&gt;/* output */&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;&amp;amp;&lt;/span&gt;numBytesEncrypted );
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;if&lt;/span&gt;( cryptStatus &lt;span style="color:#f92672"&gt;==&lt;/span&gt; kCCSuccess )
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; {
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#75715e"&gt;// The returned NSData takes ownership of the buffer and will free it on deallocation
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;return&lt;/span&gt; [NSData dataWithBytesNoCopy:buffer length:numBytesEncrypted];
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; }
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; free( buffer );
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;return&lt;/span&gt; nil;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;And now&amp;hellip; the decrypt routine&amp;hellip;&lt;/p&gt;</description></item><item><title>Fixing WebKitLocalStorageDatabasePathPreferenceKey crash</title><link>https://www.lantean.co/posts/fixing-webkitlocalstoragedatabasepathpreferencekey-crash/</link><pubDate>Mon, 07 Jan 2013 15:46:53 +0000</pubDate><guid>https://www.lantean.co/posts/fixing-webkitlocalstoragedatabasepathpreferencekey-crash/</guid><description>&lt;p&gt;I&amp;rsquo;ve been getting a lot of crashes with the following signature:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-objc" data-lang="objc"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;Exception Type: SIGABRT
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;Exception Codes: &lt;span style="color:#960050;background-color:#1e0010"&gt;#&lt;/span&gt;&lt;span style="color:#ae81ff"&gt;0&lt;/span&gt; at &lt;span style="color:#ae81ff"&gt;0x351be32c&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;Crashed Thread: &lt;span style="color:#ae81ff"&gt;0&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;Application Specific Information:
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#f92672"&gt;***&lt;/span&gt; Terminating app due to uncaught exception &lt;span style="color:#960050;background-color:#1e0010"&gt;&amp;#39;&lt;/span&gt;NSInvalidArgumentException&lt;span style="color:#960050;background-color:#1e0010"&gt;&amp;#39;&lt;/span&gt;, reason: &lt;span style="color:#960050;background-color:#1e0010"&gt;&amp;#39;&lt;/span&gt;&lt;span style="color:#f92672"&gt;-&lt;/span&gt;[__NSCFDictionary setObject:forKey:]&lt;span style="color:#f92672"&gt;:&lt;/span&gt; attempt to insert nil value (key: WebKitLocalStorageDatabasePathPreferenceKey)&lt;span style="color:#960050;background-color:#1e0010"&gt;&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;What is this?. It&amp;rsquo;s pretty well explained &lt;a href="http://www.mail-archive.com/callback-dev@incubator.apache.org/msg03468.html" rel="nofollow"&gt;here&lt;/a&gt;.
My workaround?. Quite simple. Call this method as soon as your app launches:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-objc" data-lang="objc"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;-(&lt;span style="color:#66d9ef"&gt;void&lt;/span&gt;)&lt;span style="color:#a6e22e"&gt;fixWebkitCrash&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; NSUserDefaults&lt;span style="color:#f92672"&gt;*&lt;/span&gt; defaults &lt;span style="color:#f92672"&gt;=&lt;/span&gt; [NSUserDefaults standardUserDefaults];
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; NSString&lt;span style="color:#f92672"&gt;*&lt;/span&gt; webkitPath &lt;span style="color:#f92672"&gt;=&lt;/span&gt; [defaults objectForKey:&lt;span style="color:#e6db74"&gt;@&amp;#34;WebKitLocalStorageDatabasePathPreferenceKey&amp;#34;&lt;/span&gt;];
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; NSString&lt;span style="color:#f92672"&gt;*&lt;/span&gt; bundlePath &lt;span style="color:#f92672"&gt;=&lt;/span&gt; [[[NSBundle mainBundle] bundlePath] stringByDeletingLastPathComponent];
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; 
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;if&lt;/span&gt;([webkitPath containsString:bundlePath] &lt;span style="color:#f92672"&gt;==&lt;/span&gt; NO)
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; {
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; [defaults removeObjectForKey:&lt;span style="color:#e6db74"&gt;@&amp;#34;WebKitLocalStorageDatabasePathPreferenceKey&amp;#34;&lt;/span&gt;];
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; [defaults synchronize];
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; }
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Hopefully, this will save you a couple hours!.&lt;/p&gt;</description></item><item><title>Fixing "iTunes was unable to load dataclass” Error</title><link>https://www.lantean.co/posts/fixing-itunes-was-unable-to-load-dataclass-error/</link><pubDate>Tue, 04 Dec 2012 13:34:15 +0000</pubDate><guid>https://www.lantean.co/posts/fixing-itunes-was-unable-to-load-dataclass-error/</guid><description>&lt;p&gt;I&amp;rsquo;ve been dealing with the &amp;ldquo;iTunes was unable to load dataclass&amp;rdquo; for several hours.
I&amp;rsquo;ve uninstalled iTunes, Xcode, deleted the Mobile Device Support&amp;hellip; reinstalled everything, booted the system, and nothing seemed to work.&lt;/p&gt;
&lt;p&gt;After searching for quite some time, i&amp;rsquo;ve found &lt;a href="http://ktula.com/2009/03/20/how-to-fix-itunes-was-unable-to-load-dataclass-error/" rel="nofollow"&gt;this&lt;/a&gt; post. Long short story, if you delete this framework:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-objc" data-lang="objc"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#f92672"&gt;/&lt;/span&gt;System&lt;span style="color:#f92672"&gt;/&lt;/span&gt;Library&lt;span style="color:#f92672"&gt;/&lt;/span&gt;PrivateFrameworks&lt;span style="color:#f92672"&gt;/&lt;/span&gt;MobileDevice.framework&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&amp;hellip;and right afterwards you relaunch Xcode (which will, as a result, reinstall such framework)&amp;hellip; you should be able to get rid of this&amp;hellip; annoooooooooying problem.&lt;/p&gt;</description></item><item><title>UITableView Pull to Refresh</title><link>https://www.lantean.co/posts/uitableview-pull-to-refresh/</link><pubDate>Sat, 24 Nov 2012 12:02:00 +0000</pubDate><guid>https://www.lantean.co/posts/uitableview-pull-to-refresh/</guid><description>&lt;p&gt;I know, i know. Apple&amp;rsquo;s iOS 6 introduces a new component (which is already available in the sdk)&amp;hellip; that allows you to refresh a table whenever the user pulls it.&lt;/p&gt;
&lt;p&gt;However&amp;hellip; not everyone is targetting iOS 6 +&amp;hellip; at least not yet. So, i&amp;rsquo;d like to share a link with you. Sam Vermette, a fellow with a couple public github repositories, did an excellent job writing an UIScrollView extension. It&amp;rsquo;s super easy to setup&amp;hellip; clean, and most of all, self contained.&lt;/p&gt;</description></item><item><title>Resetting the Push Notifications Permissions Alert on iOS</title><link>https://www.lantean.co/posts/resetting-the-push-notifications-permissions-alert-on-ios/</link><pubDate>Mon, 27 Aug 2012 19:11:45 +0000</pubDate><guid>https://www.lantean.co/posts/resetting-the-push-notifications-permissions-alert-on-ios/</guid><description>&lt;p&gt;I&amp;rsquo;m just pasting this from &lt;a href="http://developer.apple.com/library/ios/#technotes/tn2265/_index.html"&gt;Apple&amp;rsquo;s Technical note&lt;/a&gt;&amp;hellip; it&amp;rsquo;s soooo useful, yet, everytime i need to debug this, i spend at least 15 minutes with google&amp;hellip;!.&lt;/p&gt;
&lt;blockquote&gt;The first time a push-enabled app registers for push notifications, iOS asks the user if they wish to receive notifications for that app. Once the user has responded to this alert it is not presented again unless the device is restored or the app has been uninstalled for at least a day.&lt;br/&gt;
&lt;p&gt;If you want to simulate a first-time run of your app, you can leave the app uninstalled for a day. You can achieve the latter without actually waiting a day by setting the system clock forward a day or more, turning the device off completely, then turning the device back on.&lt;/blockquote&gt;&lt;/p&gt;</description></item><item><title>Fixing 'Text in UITextField moves up after editing' glitch</title><link>https://www.lantean.co/posts/458/</link><pubDate>Mon, 25 Jun 2012 17:44:36 +0000</pubDate><guid>https://www.lantean.co/posts/458/</guid><description>&lt;p&gt;I&amp;rsquo;ve recently come across this glitch in iOS: &lt;a href="http://stackoverflow.com/questions/9674566/text-in-uitextfield-moves-up-after-editing-center-while-editing" rel="nofollow"&gt;Text in UITextField moves up after editing (center while editing).&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Long short story&amp;hellip; when you end editing a textField, if you&amp;rsquo;re using a custom font, the text might move up. (If you get this glitch). Well, it turns out that this is a font specific problem&amp;hellip; it&amp;rsquo;s not in your code.&lt;/p&gt;
&lt;p&gt;So&amp;hellip; how will we solve it?. TTX!. In &lt;a href="https://www.lantean.co/osx-renaming-fonts-for-free/"&gt;this&lt;/a&gt; previous post we explained how to make TTX work in your 64 bit mac. So we&amp;rsquo;ll begin from there.&lt;/p&gt;</description></item><item><title>resignFirstResponder, the easy way!</title><link>https://www.lantean.co/posts/resigningfirstresponder-easy-way/</link><pubDate>Tue, 19 Jun 2012 17:08:05 +0000</pubDate><guid>https://www.lantean.co/posts/resigningfirstresponder-easy-way/</guid><description>&lt;p&gt;If you have an UIControl in edit mode&amp;hellip; but you have no idea which one is it&amp;hellip; and you need to resignFirstResponder, there is an easy way to do this. No, you don&amp;rsquo;t need to hook to notifications. And you don&amp;rsquo;t need to find the firstResponder. This can be solved with just one call.&lt;/p&gt;
&lt;p&gt;What you need to do is&amp;hellip;&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-objc" data-lang="objc"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;[_tableView endEditing:YES]&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Note that you could have anything else rather than a _tableView.
Easy. Right?&lt;/p&gt;</description></item><item><title>CoreAnimation: Bounce animation... like the Camera button</title><link>https://www.lantean.co/posts/coreanimation-bounce-animation-like-camera-button/</link><pubDate>Thu, 14 Jun 2012 20:11:52 +0000</pubDate><guid>https://www.lantean.co/posts/coreanimation-bounce-animation-like-camera-button/</guid><description>&lt;p&gt;Have you seen the animation in which the lockscreen bounces&amp;hellip; if you tap over the camera button?. Guess what!. That can be done, quite easily, with Core Animation.&lt;/p&gt;
&lt;p&gt;We&amp;rsquo;ll implement this as an extension to UIView. So.. add a file named &amp;lsquo;UIView+CoreAnimation.h/m&amp;rsquo;, and paste the following code:&lt;/p&gt;
&lt;p&gt;REF: Thanks to the &lt;a href="http://www.cocoanetics.com/2012/06/lets-bounce"&gt;Cocoanetics&lt;/a&gt; author for sharing this. I&amp;rsquo;ve tweaked his code just a little bit.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-objc" data-lang="objc"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;#import &amp;lt;QuartzCore/QuartzCore.h&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;+ (CAKeyframeAnimation&lt;span style="color:#f92672"&gt;*&lt;/span&gt;)&lt;span style="color:#a6e22e"&gt;dockBounceAnimationWithViewHeight:&lt;/span&gt;(CGFloat)viewHeight
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;	NSUInteger &lt;span style="color:#66d9ef"&gt;const&lt;/span&gt; kNumFactors &lt;span style="color:#f92672"&gt;=&lt;/span&gt; &lt;span style="color:#ae81ff"&gt;22&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;	CGFloat &lt;span style="color:#66d9ef"&gt;const&lt;/span&gt; kFactorsPerSec &lt;span style="color:#f92672"&gt;=&lt;/span&gt; &lt;span style="color:#ae81ff"&gt;30.0f&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;	CGFloat &lt;span style="color:#66d9ef"&gt;const&lt;/span&gt; kFactorsMaxValue &lt;span style="color:#f92672"&gt;=&lt;/span&gt; &lt;span style="color:#ae81ff"&gt;128.0f&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;	CGFloat factors[kNumFactors] &lt;span style="color:#f92672"&gt;=&lt;/span&gt; {&lt;span style="color:#ae81ff"&gt;0&lt;/span&gt;, &lt;span style="color:#ae81ff"&gt;60&lt;/span&gt;, &lt;span style="color:#ae81ff"&gt;83&lt;/span&gt;, &lt;span style="color:#ae81ff"&gt;100&lt;/span&gt;, &lt;span style="color:#ae81ff"&gt;114&lt;/span&gt;, &lt;span style="color:#ae81ff"&gt;124&lt;/span&gt;, &lt;span style="color:#ae81ff"&gt;128&lt;/span&gt;, &lt;span style="color:#ae81ff"&gt;128&lt;/span&gt;, &lt;span style="color:#ae81ff"&gt;124&lt;/span&gt;, &lt;span style="color:#ae81ff"&gt;114&lt;/span&gt;, &lt;span style="color:#ae81ff"&gt;100&lt;/span&gt;, &lt;span style="color:#ae81ff"&gt;83&lt;/span&gt;, &lt;span style="color:#ae81ff"&gt;60&lt;/span&gt;, &lt;span style="color:#ae81ff"&gt;32&lt;/span&gt;, &lt;span style="color:#ae81ff"&gt;0&lt;/span&gt;, &lt;span style="color:#ae81ff"&gt;0&lt;/span&gt;, &lt;span style="color:#ae81ff"&gt;18&lt;/span&gt;, &lt;span style="color:#ae81ff"&gt;28&lt;/span&gt;, &lt;span style="color:#ae81ff"&gt;32&lt;/span&gt;, &lt;span style="color:#ae81ff"&gt;28&lt;/span&gt;, &lt;span style="color:#ae81ff"&gt;18&lt;/span&gt;, &lt;span style="color:#ae81ff"&gt;0&lt;/span&gt;};
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;	NSMutableArray&lt;span style="color:#f92672"&gt;*&lt;/span&gt; transforms &lt;span style="color:#f92672"&gt;=&lt;/span&gt; [NSMutableArray array];
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;	&lt;span style="color:#66d9ef"&gt;for&lt;/span&gt;(NSUInteger i &lt;span style="color:#f92672"&gt;=&lt;/span&gt; &lt;span style="color:#ae81ff"&gt;0&lt;/span&gt;; i &lt;span style="color:#f92672"&gt;&amp;lt;&lt;/span&gt; kNumFactors; i&lt;span style="color:#f92672"&gt;++&lt;/span&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;	{
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;		CGFloat positionOffset &lt;span style="color:#f92672"&gt;=&lt;/span&gt; factors[i] &lt;span style="color:#f92672"&gt;/&lt;/span&gt; kFactorsMaxValue &lt;span style="color:#f92672"&gt;*&lt;/span&gt; viewHeight;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;		CATransform3D transform &lt;span style="color:#f92672"&gt;=&lt;/span&gt; CATransform3DMakeTranslation(&lt;span style="color:#ae81ff"&gt;0.0f&lt;/span&gt;, &lt;span style="color:#f92672"&gt;-&lt;/span&gt;positionOffset, &lt;span style="color:#ae81ff"&gt;0.0f&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;		[transforms addObject:[NSValue valueWithCATransform3D:transform]];
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;	}
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;	CAKeyframeAnimation&lt;span style="color:#f92672"&gt;*&lt;/span&gt; animation &lt;span style="color:#f92672"&gt;=&lt;/span&gt; [CAKeyframeAnimation animationWithKeyPath:&lt;span style="color:#e6db74"&gt;@&amp;#34;transform&amp;#34;&lt;/span&gt;];
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;	animation.repeatCount &lt;span style="color:#f92672"&gt;=&lt;/span&gt; &lt;span style="color:#ae81ff"&gt;1&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;	animation.duration &lt;span style="color:#f92672"&gt;=&lt;/span&gt; kNumFactors &lt;span style="color:#f92672"&gt;*&lt;/span&gt; &lt;span style="color:#ae81ff"&gt;1.0f&lt;/span&gt;&lt;span style="color:#f92672"&gt;/&lt;/span&gt;kFactorsPerSec;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;	animation.fillMode &lt;span style="color:#f92672"&gt;=&lt;/span&gt; kCAFillModeForwards;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;	animation.values &lt;span style="color:#f92672"&gt;=&lt;/span&gt; transforms;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;	animation.removedOnCompletion &lt;span style="color:#f92672"&gt;=&lt;/span&gt; YES; &lt;span style="color:#75715e"&gt;// final stage is equal to starting stage
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;	animation.autoreverses &lt;span style="color:#f92672"&gt;=&lt;/span&gt; NO;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;	&lt;span style="color:#66d9ef"&gt;return&lt;/span&gt; animation;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;- (&lt;span style="color:#66d9ef"&gt;void&lt;/span&gt;)&lt;span style="color:#a6e22e"&gt;jump&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;	CGFloat midHeight &lt;span style="color:#f92672"&gt;=&lt;/span&gt; self.frame.size.height &lt;span style="color:#f92672"&gt;*&lt;/span&gt; &lt;span style="color:#ae81ff"&gt;0.5f&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;	CAKeyframeAnimation&lt;span style="color:#f92672"&gt;*&lt;/span&gt; animation &lt;span style="color:#f92672"&gt;=&lt;/span&gt; [[self &lt;span style="color:#66d9ef"&gt;class&lt;/span&gt;] dockBounceAnimationWithViewHeight:midHeight];
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;	[self.layer addAnimation:animation forKey:&lt;span style="color:#e6db74"&gt;@&amp;#34;bouncing&amp;#34;&lt;/span&gt;];
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</description></item><item><title>CoreGraphics: Drawing Dashed Lines</title><link>https://www.lantean.co/posts/coregraphics-drawing-dashed-lines/</link><pubDate>Wed, 13 Jun 2012 22:31:08 +0000</pubDate><guid>https://www.lantean.co/posts/coregraphics-drawing-dashed-lines/</guid><description>&lt;p&gt;Suppose you wanna draw a dashed line all around a control. What should we do?. Well&amp;hellip; simple. We need to invoke some CoreGraphics dark magic&amp;hellip; it&amp;rsquo;s pretty self explanatory. The catch to it is that it&amp;rsquo;ll draw a dashed line. Play with it..!&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-objc" data-lang="objc"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;static&lt;/span&gt; CGFloat &lt;span style="color:#66d9ef"&gt;const&lt;/span&gt; kDashedBorderWidth &lt;span style="color:#f92672"&gt;=&lt;/span&gt; (&lt;span style="color:#ae81ff"&gt;2.0f&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;static&lt;/span&gt; CGFloat &lt;span style="color:#66d9ef"&gt;const&lt;/span&gt; kDashedPhase &lt;span style="color:#f92672"&gt;=&lt;/span&gt; (&lt;span style="color:#ae81ff"&gt;0.0f&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;static&lt;/span&gt; CGFloat &lt;span style="color:#66d9ef"&gt;const&lt;/span&gt; kDashedLinesLength[] &lt;span style="color:#f92672"&gt;=&lt;/span&gt; {&lt;span style="color:#ae81ff"&gt;4.0f&lt;/span&gt;, &lt;span style="color:#ae81ff"&gt;2.0f&lt;/span&gt;};
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;static&lt;/span&gt; size_t &lt;span style="color:#66d9ef"&gt;const&lt;/span&gt; kDashedCount &lt;span style="color:#f92672"&gt;=&lt;/span&gt; (&lt;span style="color:#ae81ff"&gt;2.0f&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;- (&lt;span style="color:#66d9ef"&gt;void&lt;/span&gt;)&lt;span style="color:#a6e22e"&gt;drawRect:&lt;/span&gt;(CGRect)rect
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; [super drawRect:rect];
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; CGContextRef context &lt;span style="color:#f92672"&gt;=&lt;/span&gt; UIGraphicsGetCurrentContext();
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; CGContextSetLineWidth(context, kDashedBorderWidth);
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; CGContextSetStrokeColorWithColor(context, [UIColor grayColor].CGColor);
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; CGContextSetLineDash(context, kDashedPhase, kDashedLinesLength, kDashedCount) ;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; CGContextAddRect(context, rect);
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; CGContextStrokePath(context);
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</description></item><item><title>Current Selector's Name</title><link>https://www.lantean.co/posts/current-selectors-name/</link><pubDate>Mon, 04 Jun 2012 16:07:11 +0000</pubDate><guid>https://www.lantean.co/posts/current-selectors-name/</guid><description>&lt;p&gt;So&amp;hellip; suppose you wanna log the name of the &amp;lsquo;current&amp;rsquo; method. You could hardcode the method name, right there&amp;hellip; virtually everywhere&amp;hellip; or you can do this:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-objc" data-lang="objc"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;NSLog(&lt;span style="color:#e6db74"&gt;@&amp;#34;[ %@ ] did something&amp;#34;&lt;/span&gt;, NSStringFromSelector(_cmd));&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;It&amp;rsquo;s simple. Yet, its something i didn&amp;rsquo;t know&amp;hellip; three days ago!.&lt;/p&gt;</description></item><item><title>Twitter iOS SDK</title><link>https://www.lantean.co/posts/twitter-ios-sdk/</link><pubDate>Sat, 19 May 2012 11:49:08 +0000</pubDate><guid>https://www.lantean.co/posts/twitter-ios-sdk/</guid><description>&lt;p&gt;I recently had to integrate one of my apps with Twitter. Let me say you something. I HATE TWITTER guys. Why?. Because everything is soooo complicated. Although there is a direct integration between Twitter and iOS 5, they have made it really hard for developers.&lt;/p&gt;
&lt;p&gt;Why?. If you need to post tweets, backend side, you need to ask for &amp;lsquo;&lt;a href="https://dev.twitter.com/docs/ios/using-reverse-auth" rel="nofollow"&gt;Reverse Auth&lt;/a&gt;&amp;rsquo; permissions.. and it&amp;rsquo;s not something that can be done automatically. They have to personally approve this.&lt;/p&gt;</description></item><item><title>Fixing Bootstrap Errors</title><link>https://www.lantean.co/posts/fixing-bootstrap-errors/</link><pubDate>Wed, 09 May 2012 23:40:38 +0000</pubDate><guid>https://www.lantean.co/posts/fixing-bootstrap-errors/</guid><description>&lt;p&gt;I&amp;rsquo;ve been having this error&amp;hellip; A LOT&amp;hellip;:&lt;/p&gt;
&lt;p&gt;&amp;ldquo;Couldn&amp;rsquo;t register com.yourcompany.yourapp with the bootstrap server. Error: unknown error code. This generally means that another instance of this process was already running or is hung in the debugger.&amp;rdquo;&lt;/p&gt;
&lt;p&gt;The bad side of this is that.. ps aux will not show anything useful. Thankfully, Mike Ash has solved this&amp;hellip; i&amp;rsquo;m pasting below his script:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-objc" data-lang="objc"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;launchctl list&lt;span style="color:#f92672"&gt;|&lt;/span&gt;grep UIKitApplication&lt;span style="color:#f92672"&gt;|&lt;/span&gt;awk &lt;span style="color:#960050;background-color:#1e0010"&gt;&amp;#39;&lt;/span&gt;{print &lt;span style="color:#960050;background-color:#1e0010"&gt;$&lt;/span&gt;&lt;span style="color:#ae81ff"&gt;3&lt;/span&gt;}&lt;span style="color:#960050;background-color:#1e0010"&gt;&amp;#39;&lt;/span&gt;&lt;span style="color:#f92672"&gt;|&lt;/span&gt;xargs launchctl remove&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Source: &lt;a href="http://www.mikeash.com/pyblog/solving-simulator-bootstrap-errors.html" target="_blank"&gt;Mike Ash Blog&lt;/a&gt;&lt;/p&gt;</description></item><item><title>Removing subviews that match any given criteria!</title><link>https://www.lantean.co/posts/removing-subview-of-a-given-kind/</link><pubDate>Wed, 09 May 2012 22:50:27 +0000</pubDate><guid>https://www.lantean.co/posts/removing-subview-of-a-given-kind/</guid><description>&lt;p&gt;So&amp;hellip; suppose that you have a container view. And for some reason, you need to remove the subviews that match any given criteria.&lt;/p&gt;
&lt;p&gt;The straightforward solution would be to write a foreach loop, by hand, and remove the target subviews with a method call. Guess what!. There is a kung fu solution to this..!!. Check this out:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-objc" data-lang="objc"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;NSPredicate&lt;span style="color:#f92672"&gt;*&lt;/span&gt; predicate &lt;span style="color:#f92672"&gt;=&lt;/span&gt; [NSPredicate predicateWithFormat:&lt;span style="color:#e6db74"&gt;@&amp;#34;self isKindOfClass: %@&amp;#34;&lt;/span&gt;, [SomeView &lt;span style="color:#66d9ef"&gt;class&lt;/span&gt;]];
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;NSArray&lt;span style="color:#f92672"&gt;*&lt;/span&gt; viewsToRemove &lt;span style="color:#f92672"&gt;=&lt;/span&gt; [[self subviews] filteredArrayUsingPredicate:predicate];
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;[viewsToRemove makeObjectsPerformSelector:&lt;span style="color:#66d9ef"&gt;@selector&lt;/span&gt;(removeFromSuperview)];&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Less code is better. Always.&lt;/p&gt;</description></item><item><title>Detecting taps in any UIView subclass</title><link>https://www.lantean.co/posts/detecting-taps-in-any-uiview-subclass/</link><pubDate>Wed, 09 May 2012 22:46:55 +0000</pubDate><guid>https://www.lantean.co/posts/detecting-taps-in-any-uiview-subclass/</guid><description>&lt;p&gt;This one is a quick and easy trick. How do you detect taps in any UIView?.
Simple. You need to use the UITapGestureRecognizer class&amp;hellip; this way:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-objc" data-lang="objc"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;// Alloc the gesture recognizer
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;UITapGestureRecognizer&lt;span style="color:#f92672"&gt;*&lt;/span&gt; tapGestureRecognizer &lt;span style="color:#f92672"&gt;=&lt;/span&gt; [[UITapGestureRecognizer alloc] initWithTarget:self action:&lt;span style="color:#66d9ef"&gt;@selector&lt;/span&gt;(viewTapped)];
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;[tapGestureRecognizer setNumberOfTapsRequired:&lt;span style="color:#ae81ff"&gt;1&lt;/span&gt;];
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;[anyRandomView addGestureRecognizer:tapGestureRecognizer];
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;[anyRandomView setUserInteractionEnabled:YES];
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;[tapGestureRecognizer &lt;span style="color:#66d9ef"&gt;release&lt;/span&gt;];
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;tapGestureRecognizer &lt;span style="color:#f92672"&gt;=&lt;/span&gt; nil;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</description></item><item><title>UILabel with Stroke!</title><link>https://www.lantean.co/posts/uilabel-with-stroke/</link><pubDate>Fri, 04 May 2012 20:40:29 +0000</pubDate><guid>https://www.lantean.co/posts/uilabel-with-stroke/</guid><description>&lt;p&gt;Time to invoke some&amp;hellip; dark magic. For some reason, UILabel doesn&amp;rsquo;t support stroke. So, if you&amp;rsquo;re&amp;hellip; by chance&amp;hellip; working on a videogame, or a simple iOS app, and you actually need to render an UILabel with a stroke, in a given color, you have come to the right place.&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s begin with the header file:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-objc" data-lang="objc"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;@interface&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;LAStrokeLabel&lt;/span&gt; : &lt;span style="color:#a6e22e"&gt;UILabel&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; NSUInteger _strokeWidth;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;    UIColor&lt;span style="color:#f92672"&gt;*&lt;/span&gt; _strokeColor;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;@property&lt;/span&gt; (&lt;span style="color:#66d9ef"&gt;nonatomic&lt;/span&gt;, &lt;span style="color:#66d9ef"&gt;assign&lt;/span&gt;) NSUInteger strokeWidth;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;@property&lt;/span&gt; (&lt;span style="color:#66d9ef"&gt;nonatomic&lt;/span&gt;, &lt;span style="color:#66d9ef"&gt;retain&lt;/span&gt;) UIColor&lt;span style="color:#f92672"&gt;*&lt;/span&gt; strokeColor;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;@end&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;So far so good&amp;hellip; right?. Nothing weird. Just a simple UILabel subclass, with two extra properties.&lt;/p&gt;</description></item><item><title>Display a modal UIViewController when a UITabBarItem is pressed</title><link>https://www.lantean.co/posts/display-a-modal-uiviewcontroller-when-a-uitabbaritem-is-pressed/</link><pubDate>Thu, 03 May 2012 17:54:13 +0000</pubDate><guid>https://www.lantean.co/posts/display-a-modal-uiviewcontroller-when-a-uitabbaritem-is-pressed/</guid><description>&lt;p&gt;Suppose the following scenario. You need to display a modal UIViewController whenever the user presses a specific button in a UITabBar.&lt;/p&gt;
&lt;p&gt;The trick is pretty simple. First, add an empty UIViewController, wich will serve as placeholder for the &amp;lsquo;modal tab&amp;rsquo;:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-objc" data-lang="objc"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;UIViewController&lt;span style="color:#f92672"&gt;*&lt;/span&gt; someViewController    &lt;span style="color:#f92672"&gt;=&lt;/span&gt; [[UIViewController alloc] init];
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;[someViewController setTitle:NSLocalizedString(&lt;span style="color:#e6db74"&gt;@&amp;#34;Modal Tab&amp;#34;&lt;/span&gt;, nil)];
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;[someViewController.tabBarItem setImage:[UIImage imageNamed:&lt;span style="color:#e6db74"&gt;@&amp;#34;modal.png&amp;#34;&lt;/span&gt;]];&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Then, setup the UITabBarController&amp;rsquo;s delegate:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-objc" data-lang="objc"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;[_tabBarController setDelegate:self];&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;At last&amp;hellip; you need to implement the UITabBarControllerDelegate protocol. Specifically, something that looks like this:&lt;/p&gt;</description></item><item><title>iOS and JavaScript Bridge</title><link>https://www.lantean.co/posts/ios-and-javascript-bridge/</link><pubDate>Sat, 21 Apr 2012 13:22:45 +0000</pubDate><guid>https://www.lantean.co/posts/ios-and-javascript-bridge/</guid><description>&lt;p&gt;What if you need to write a completely dynamic app, and you need to have the ability of updating the App&amp;rsquo;s contents remotely, without the need of pushing a new build to the AppStore?.&lt;/p&gt;
&lt;p&gt;What if you need to write javascript code, which needs to interact with your iOS code?.
Yeah. I had that problem. Long short story, i&amp;rsquo;m testing a nice framework called &lt;a title="Clutch" href="https://clutch.io/" rel="nofollow"&gt;clutch&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Clutch has a nice JavaScript and iOS SDK, which smoothens the interaction between those two technologies. When you ship the app, you bundle a version of the webApp in it.&lt;/p&gt;</description></item><item><title>Targetting iPhone 3gs and superior</title><link>https://www.lantean.co/posts/targetting-iphone-3gs-and-superior/</link><pubDate>Sat, 21 Apr 2012 12:36:16 +0000</pubDate><guid>https://www.lantean.co/posts/targetting-iphone-3gs-and-superior/</guid><description>&lt;p&gt;I recently had a problem with one of the apps i&amp;rsquo;m working on. (Yeah, yet another problem!). The first release supported ARMv6 (which is handy when targetting older devices, as well, such as 1st and 2nd iPod generations, and the old iPhone 3g).&lt;/p&gt;
&lt;p&gt;As it turns out, you cannot change the requirements of an app after pushing an update. I mean, you cannot simply remove &amp;lsquo;ARMv6&amp;rsquo; support. Apple&amp;rsquo;s policy is that &amp;hellip; you should continue supporting all of the target platforms you&amp;rsquo;ve enabled in the very first release.&lt;/p&gt;</description></item><item><title>GPS in Safari Mobile</title><link>https://www.lantean.co/posts/gps-in-safari-mobile/</link><pubDate>Thu, 19 Apr 2012 10:46:25 +0000</pubDate><guid>https://www.lantean.co/posts/gps-in-safari-mobile/</guid><description>&lt;p&gt;So&amp;hellip; what if you wanna get the GPS position, but within a WebApp&amp;rsquo;s context?. There are several tools, such as PhoneGap, that encapsulate GPS access. But it turns out that there is an extremely easy way to accomplish this task.&lt;/p&gt;
&lt;p&gt;Check out this JavaScript snippet&amp;hellip; easy, right?&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-objc" data-lang="objc"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;navigator.geolocation.getCurrentPosition(foundLocation, noLocation);
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;function &lt;span style="color:#a6e22e"&gt;foundLocation&lt;/span&gt;(position)
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; var lat &lt;span style="color:#f92672"&gt;=&lt;/span&gt; position.coords.latitude;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; var &lt;span style="color:#66d9ef"&gt;long&lt;/span&gt; &lt;span style="color:#f92672"&gt;=&lt;/span&gt; position.coords.longitude;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; alert(&lt;span style="color:#960050;background-color:#1e0010"&gt;&amp;#39;&lt;/span&gt;Found location: &lt;span style="color:#960050;background-color:#1e0010"&gt;&amp;#39;&lt;/span&gt; &lt;span style="color:#f92672"&gt;+&lt;/span&gt; lat &lt;span style="color:#f92672"&gt;+&lt;/span&gt; &lt;span style="color:#960050;background-color:#1e0010"&gt;&amp;#39;&lt;/span&gt;, &lt;span style="color:#960050;background-color:#1e0010"&gt;&amp;#39;&lt;/span&gt; &lt;span style="color:#f92672"&gt;+&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;long&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;function &lt;span style="color:#a6e22e"&gt;noLocation&lt;/span&gt;()
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; alert(&lt;span style="color:#960050;background-color:#1e0010"&gt;&amp;#39;&lt;/span&gt;Could not find location&lt;span style="color:#960050;background-color:#1e0010"&gt;&amp;#39;&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</description></item><item><title>Debugging BAD_ACCESS crashes</title><link>https://www.lantean.co/posts/debugging-bad_access-crashes/</link><pubDate>Sun, 15 Apr 2012 23:26:15 +0000</pubDate><guid>https://www.lantean.co/posts/debugging-bad_access-crashes/</guid><description>&lt;p&gt;Newbies can rely on ARC to handle memory management. But personally, i&amp;rsquo;d rather handling everything myself. Old school!.&lt;/p&gt;
&lt;p&gt;Besides that, you&amp;rsquo;ll probably need to support iOS 4 devices, as well. So&amp;hellip; at least for now, Memory Management is kind of a mandatory chapter, to everyone!.&lt;/p&gt;
&lt;p&gt;So what happens when you get a &amp;lsquo;BAD_ACCESS&amp;rsquo; crash?. There are just so many scenarios that can trigger that crash&amp;hellip; but the most common is simply a message sent to a dealloc&amp;rsquo;ed object.&lt;/p&gt;</description></item><item><title>Using 'performSelector: withObject: afterDelay:'!</title><link>https://www.lantean.co/posts/preventing-freeze-in-main-thread/</link><pubDate>Sun, 15 Apr 2012 21:26:10 +0000</pubDate><guid>https://www.lantean.co/posts/preventing-freeze-in-main-thread/</guid><description>&lt;p&gt;Sometimes, when developing an iOS application, we need to do something like &amp;lsquo;displaying a spinner&amp;rsquo;, and right after that, do a tedious task, such as query&amp;rsquo;ing a database, sorting a file, or hitting a backend.&lt;/p&gt;
&lt;p&gt;As you may (or may not know)&amp;hellip; all of the UIKit framework works on the Main Thread (with several exceptions, set aside). A common problem we might encounter is that&amp;hellip; if you begin a long process after initializing an ActivityIndicatorView, the main thread will remain locked out, and thus&amp;hellip; the spinner will never begin.&lt;/p&gt;</description></item><item><title>Preventing Paste in UITextField</title><link>https://www.lantean.co/posts/preventing-paste-in-uitextfield/</link><pubDate>Sun, 15 Apr 2012 19:43:39 +0000</pubDate><guid>https://www.lantean.co/posts/preventing-paste-in-uitextfield/</guid><description>&lt;p&gt;Suppose that your app has a custom keyboard (or component) which populates an UITextField. So&amp;hellip; suppose that you need to enable the User Interaction with that control. However, you don&amp;rsquo;t wanna anyone pasting values right there&amp;hellip; because you wanna force the user to rely on your custom keyboard.&lt;/p&gt;
&lt;p&gt;UITextField lacks a &amp;lsquo;disablePaste&amp;rsquo; property. In order to do this, we&amp;rsquo;re gonna need to subclass UITextField. Our subclass should look like this&amp;hellip;&lt;/p&gt;</description></item><item><title>UIView with Rounded Corners</title><link>https://www.lantean.co/posts/uiview-with-rounded-corners/</link><pubDate>Sun, 15 Apr 2012 19:33:42 +0000</pubDate><guid>https://www.lantean.co/posts/uiview-with-rounded-corners/</guid><description>&lt;p&gt;Sooner rather than later, you&amp;rsquo;ll probably end up with a simple yet tricky requirement: an UIView with rounded corners.&lt;/p&gt;
&lt;p&gt;iOS SDK has no &amp;lsquo;radius&amp;rsquo; property. Ohhh wait!. Yeah, it actually has!. But the catch to it is that you need to import Quartz framework, first:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-objc" data-lang="objc"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;#import &amp;lt;QuartzCore/QuartzCore.h&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Also, you need to link the &amp;lsquo;QuartzCore.framework&amp;rsquo;. Otherwise the import won&amp;rsquo;t work.&lt;/p&gt;
&lt;p&gt;So&amp;hellip; how do you actually display an UIView with rounded corners?. Easy!&lt;/p&gt;</description></item><item><title>Removing Push Notifications from NotificationBar</title><link>https://www.lantean.co/posts/removing-push-notifications-from-notificationbar/</link><pubDate>Wed, 11 Apr 2012 12:24:03 +0000</pubDate><guid>https://www.lantean.co/posts/removing-push-notifications-from-notificationbar/</guid><description>&lt;p&gt;I have come up with a weird problem&amp;hellip;. which goes as follows:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;The app receives a Push Notification.&lt;/li&gt;
&lt;li&gt;You tap over the PN (in the iOS notification center).&lt;/li&gt;
&lt;li&gt;The app gets launched&amp;hellip; and you handle the notification&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Problem&lt;/strong&gt;: the notification remains in the &amp;rsquo;notification bar'.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;How do you clean it ?. Well&amp;hellip; this isn&amp;rsquo;t in Apple&amp;rsquo;s docs. But i&amp;rsquo;ve figured out that if you execute the following line of code, the notification &amp;lsquo;gets acknowledged&amp;rsquo;:&lt;/p&gt;</description></item><item><title>JSON Parsers</title><link>https://www.lantean.co/posts/json-parsers/</link><pubDate>Sun, 08 Apr 2012 22:41:21 +0000</pubDate><guid>https://www.lantean.co/posts/json-parsers/</guid><description>&lt;p&gt;XML days are numbered&amp;hellip;. it&amp;rsquo;s just my opinion. I know, it&amp;rsquo;s out there in the wild, almost everywhere. But XML itself has a huge overhead, which is something we, as mobile software developers, really want to avoid.&lt;/p&gt;
&lt;p&gt;Personally, i just love json. It&amp;rsquo;s extremely lightweight&amp;hellip; and i dare to say, it is what XML should have been. Why is it exactly that you need to repeat a keyword once and over and over&amp;hellip;???. I still don&amp;rsquo;t get what those guys were thinking&amp;hellip; when they wrote the XML specs.&lt;/p&gt;</description></item><item><title>HTML Color to UIColor</title><link>https://www.lantean.co/posts/html-color-to-uicolor/</link><pubDate>Fri, 06 Apr 2012 14:30:03 +0000</pubDate><guid>https://www.lantean.co/posts/html-color-to-uicolor/</guid><description>&lt;p&gt;This is a nice tool i&amp;rsquo;d like to share with you. While skinning your app, you might need to convert HTML color codes into those that are actually accepted by UIKit framework (which, by the way, is HEX!).&lt;/p&gt;
&lt;p&gt;So&amp;hellip; you need to fire Photoshop, or find a website that does that for you. Well, i just found a nice app called HexColors. It&amp;rsquo;s in the Mac AppStore, and it&amp;rsquo;s free (go get it!).&lt;/p&gt;</description></item><item><title>UITableViewCell without borders!</title><link>https://www.lantean.co/posts/uitableviewcell-without-borders/</link><pubDate>Fri, 06 Apr 2012 14:21:40 +0000</pubDate><guid>https://www.lantean.co/posts/uitableviewcell-without-borders/</guid><description>&lt;p&gt;Suppose that you have an UITableView with a borderColor. Everything is cool and easy&amp;hellip; as long as you don&amp;rsquo;t need to break the mold.&lt;/p&gt;
&lt;p&gt;But if you ever need to add just ONE single cell without borders, you&amp;rsquo;ll notice that there is no way to do it. Well, it turns out that there is. But it&amp;rsquo;s not a straightforward one. You simply need to do this:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-objc" data-lang="objc"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;UIView&lt;span style="color:#f92672"&gt;*&lt;/span&gt; emptyBackView &lt;span style="color:#f92672"&gt;=&lt;/span&gt; [[UIView alloc] initWithFrame:CGRectZero];
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;[cell setBackgroundView:emptyBackView];
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;[emptyBackView &lt;span style="color:#66d9ef"&gt;release&lt;/span&gt;];
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;emptyBackView &lt;span style="color:#f92672"&gt;=&lt;/span&gt; nil;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Magic, ha?. If you add an empty backgroundView (with its background set to clearColor), the cell&amp;rsquo;s border will be gone.&lt;/p&gt;</description></item><item><title>OSX: Renaming Fonts (For Free!)</title><link>https://www.lantean.co/posts/osx-renaming-fonts-for-free/</link><pubDate>Thu, 29 Mar 2012 23:22:07 +0000</pubDate><guid>https://www.lantean.co/posts/osx-renaming-fonts-for-free/</guid><description>&lt;p&gt;I just got a huge problem. I&amp;rsquo;m working on an iOS app, and it turns out that we need to maintain compatibility with iOS 4. So&amp;hellip; the problem is that we use custom fonts. A lot of them. That shouldn&amp;rsquo;t be an issue. BUT&amp;hellip; i got to notice that iOS 4 supports up to two different fonts per family.&lt;/p&gt;
&lt;p&gt;Long short story, if you&amp;rsquo;ve got a font family with&amp;hellip; 5 different fonts, iOS 4 will load just two of  them. So how do we solve it?.&lt;/p&gt;</description></item><item><title>NSMutableSet: Filtering Duplicate Elements</title><link>https://www.lantean.co/posts/nsmutableset-filtering-duplicate-elements/</link><pubDate>Tue, 20 Mar 2012 02:16:28 +0000</pubDate><guid>https://www.lantean.co/posts/nsmutableset-filtering-duplicate-elements/</guid><description>&lt;p&gt;Suppose that your app has X amount cached objects. And suppose that there is a slight chance that.. since the backend doesn´t actually know what it is exactly that you have cached (and what you don´t have cached), it might send duplicates.&lt;/p&gt;
&lt;p&gt;So&amp;hellip; what do we do?. Shall we write a for routine checking dupes?. No way. There is a far more performant way to achieve this, and it requires less lines of code.&lt;/p&gt;</description></item><item><title>Grand Central Dispatch: Perform Block After Delay</title><link>https://www.lantean.co/posts/grand-central-dispatch-perform-block-after-delay/</link><pubDate>Tue, 20 Mar 2012 02:06:21 +0000</pubDate><guid>https://www.lantean.co/posts/grand-central-dispatch-perform-block-after-delay/</guid><description>&lt;p&gt;We have seen &lt;a title="GCD Singletons" href="https://www.lantean.co/grand-central-dispatch-singletons/"&gt;in a previous post &lt;/a&gt;the proper way to write a singleton, with the help of our good friend Grand Central Dispatch.&lt;/p&gt;
&lt;p&gt;In this opportunity, i´d like to share a goodie i´ve learnt few days ago. I suppose many of you had problems with the following scenario. You have to perform a task, which is time consuming, and you need to place, onscreen, an Activity Indicator.&lt;/p&gt;
&lt;p&gt;Although the Activity Indicator performs the animation on its own thread, you need to &amp;ldquo;spare some time&amp;rdquo; in the main thread for it to begin working. I mean&amp;hellip; you can execute [indicator startAnimating] right away. But&amp;hellip; if you don´t release the main thread, even for a short moment, surprise!. The spinner won´t work.&lt;/p&gt;</description></item><item><title>UITableView: Make room for a new cell, and insert it!</title><link>https://www.lantean.co/posts/uitableview-make-room-for-a-new-cell-and-insert-it/</link><pubDate>Fri, 16 Mar 2012 22:06:35 +0000</pubDate><guid>https://www.lantean.co/posts/uitableview-make-room-for-a-new-cell-and-insert-it/</guid><description>&lt;p&gt;Suppose you wanna insert a new row at the bottom of a table. The first thing you need to do is to calculate the content offset. Suppose you already know the height of the new cell, and it&amp;rsquo;s stored into the variable &amp;rsquo;newCellsHeight&amp;rsquo;. Then&amp;hellip;&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-objc" data-lang="objc"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;CGPoint contentOffset &lt;span style="color:#f92672"&gt;=&lt;/span&gt; CGPointZero;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;contentOffset.y &lt;span style="color:#f92672"&gt;=&lt;/span&gt; _tableView.contentSize.height
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;+&lt;/span&gt; newCellsHeight
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;-&lt;/span&gt; _tableView.frame.size.height
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;+&lt;/span&gt; _tableView.contentInset.bottom;&lt;span style="color:#f92672"&gt;&amp;lt;/&lt;/span&gt;pre&lt;span style="color:#f92672"&gt;&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;Once you&lt;span style="color:#960050;background-color:#1e0010"&gt;&amp;#39;&lt;/span&gt;ve calculated the contentOffset (considering the current contentInsets)... you should make sure it&lt;span style="color:#960050;background-color:#1e0010"&gt;&amp;#39;&lt;/span&gt;s a non&lt;span style="color:#f92672"&gt;-&lt;/span&gt;negative value, to prevent quirks:
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;// Do we need to scroll down?
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;if&lt;/span&gt;(contentOffset.y &lt;span style="color:#f92672"&gt;&amp;amp;&lt;/span&gt;gt; &lt;span style="color:#ae81ff"&gt;0.0f&lt;/span&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; [_tableView setContentOffset:contentOffset animated:YES];
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The last step would be to actually insert the rows. Please, consider that a delay should be applied, so the insert rows animations won&amp;rsquo;t break the scroll animation!&lt;/p&gt;</description></item><item><title>Xcode: Number of lines</title><link>https://www.lantean.co/posts/xcode-number-of-lines/</link><pubDate>Fri, 16 Mar 2012 21:52:49 +0000</pubDate><guid>https://www.lantean.co/posts/xcode-number-of-lines/</guid><description>&lt;p&gt;I&amp;rsquo;ve been unable to figure out how to do this, actually, within Xcode. But this can also be accomplished by means of this short script:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-objc" data-lang="objc"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;find . &lt;span style="color:#e6db74"&gt;&amp;#34;(&amp;#34;&lt;/span&gt; &lt;span style="color:#f92672"&gt;-&lt;/span&gt;name &lt;span style="color:#e6db74"&gt;&amp;#34;*.m&amp;#34;&lt;/span&gt; &lt;span style="color:#f92672"&gt;-&lt;/span&gt;or &lt;span style="color:#f92672"&gt;-&lt;/span&gt;name &lt;span style="color:#e6db74"&gt;&amp;#34;*.mm&amp;#34;&lt;/span&gt; &lt;span style="color:#f92672"&gt;-&lt;/span&gt;or &lt;span style="color:#f92672"&gt;-&lt;/span&gt;name &lt;span style="color:#e6db74"&gt;&amp;#34;*.cpp&amp;#34;&lt;/span&gt; &lt;span style="color:#e6db74"&gt;&amp;#34;)&amp;#34;&lt;/span&gt; &lt;span style="color:#f92672"&gt;-&lt;/span&gt;print &lt;span style="color:#f92672"&gt;|&lt;/span&gt; xargs wc &lt;span style="color:#f92672"&gt;-&lt;/span&gt;l&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</description></item><item><title>Google Chrome Plugins</title><link>https://www.lantean.co/posts/google-chrome-plugins/</link><pubDate>Thu, 15 Mar 2012 03:21:01 +0000</pubDate><guid>https://www.lantean.co/posts/google-chrome-plugins/</guid><description>&lt;p&gt;Google Chrome&amp;rsquo;s time has come. I love this browser because&amp;hellip; it&amp;rsquo;s the fastest thing out there. It had a lot of glitches when it was first released. I remember Facebook wouldn&amp;rsquo;t work fine on it&amp;hellip; and of course, i had to fix the HTML of many of the websites i maintain.&lt;/p&gt;
&lt;p&gt;But i stil love it. It gets updated in background&amp;hellip; and you hardly get to notice it!. As almost everything out there&amp;hellip; it&amp;rsquo;s better when tweaked&amp;hellip; right?. So i&amp;rsquo;d like to recommend three different plugins, available in the Chrome Web Store:&lt;/p&gt;</description></item><item><title>Xcode 4.3.1</title><link>https://www.lantean.co/posts/xcode-4-3-1/</link><pubDate>Thu, 15 Mar 2012 02:50:34 +0000</pubDate><guid>https://www.lantean.co/posts/xcode-4-3-1/</guid><description>&lt;p&gt;&lt;a href="https://www.lantean.co/wp-content/uploads/2012/03/Screen-Shot-2012-03-14-at-11.46.46-PM.png"&gt;&lt;img class="size-full wp-image-187" title="Screen-Shot-2012-03-14-at-11.46.46-PM-150x150" src="https://www.lantean.co/wp-content/uploads/2012/03/Screen-Shot-2012-03-14-at-11.46.46-PM.png" alt="" width="150" height="150" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;If you haven&amp;rsquo;t done so&amp;hellip; go grab the latest release of Xcode. But beware&amp;hellip; as soon as you download it, it&amp;rsquo;ll overwrite your current 4.3 installation. It comes &lt;strong&gt;without &lt;/strong&gt;sdk&amp;rsquo;s 5.0 and below. So&amp;hellip; as usually&amp;hellip; i recommend you do that after your looong working journey.&lt;/p&gt;
&lt;p&gt;Otherwise you might find yourself stuck watching the download progress bar. No&amp;hellip; that didn&amp;rsquo;t happen to me&amp;hellip; i swear!.&lt;/p&gt;
&lt;p&gt;Bad thing is that Apple didn&amp;rsquo;t fix the Refactor functionality, yet. It&amp;rsquo;s getting kinda difficult to rename class names. For some reason, i keep getting an annoying popup saying that it cannot be done. There are several posts in stackoverflow saying that Dropbox might cause that&amp;hellip; but my projects are not inside a Dropbox folder, so that option can be discarded.&lt;/p&gt;</description></item><item><title>Preventing crashes: JSON Parsers &amp;amp; Null entries!</title><link>https://www.lantean.co/posts/preventing-crashes-json-parsers-null-entries/</link><pubDate>Fri, 09 Mar 2012 16:35:06 +0000</pubDate><guid>https://www.lantean.co/posts/preventing-crashes-json-parsers-null-entries/</guid><description>&lt;p&gt;How many times you got to parse a backend response, and tested if a given value is != nil?. Well, as it turns out, many parsers (such as JSONKit) will parse &amp;rsquo;null&amp;rsquo; values into an instance of NSNull. That might cause a crash&amp;hellip; unless you write eeeverywhere&amp;hellip; &amp;lsquo;!= nil &amp;amp;&amp;amp; != [NSNull null]&amp;rsquo;.&lt;/p&gt;
&lt;p&gt;So&amp;hellip; a good idea would be to implement an NSDictionary extention, to do that. Right?.
The method would look like this:&lt;/p&gt;</description></item><item><title>Filtering arrays with NSPredicate!</title><link>https://www.lantean.co/posts/filtering-arrays-with-nspredicate/</link><pubDate>Fri, 09 Mar 2012 12:24:42 +0000</pubDate><guid>https://www.lantean.co/posts/filtering-arrays-with-nspredicate/</guid><description>&lt;p&gt;Suppose you wanna filter a collection of objects. Normally, you&amp;rsquo;d write a while loop, implement a comparison, and add the matching objects to a collection.&lt;/p&gt;
&lt;p&gt;Well, there is an easier way!!. For the sake of this example, say you wanna filter the objects that have the BOOL &amp;lsquo;isEnabled set to YES. So, you could do the following:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-objc" data-lang="objc"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;NSPredicate&lt;span style="color:#f92672"&gt;*&lt;/span&gt; predicate &lt;span style="color:#f92672"&gt;=&lt;/span&gt; [NSPredicate predicateWithFormat:&lt;span style="color:#e6db74"&gt;@&amp;#34;isEnabled == YES&amp;#34;&lt;/span&gt;]; NSArray &lt;span style="color:#f92672"&gt;*&lt;/span&gt;filteredArray &lt;span style="color:#f92672"&gt;=&lt;/span&gt; [myArray filteredArrayUsingPredicate:predicate];&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Yet another powerful example of NSPredicate would be&amp;hellip; remember &amp;lsquo;SELECT* WHERE FIELD IN(1, 2)&amp;rsquo; ?. Guess what!&lt;/p&gt;</description></item><item><title>Memory Management Tips!</title><link>https://www.lantean.co/posts/memory-management-tips/</link><pubDate>Thu, 08 Mar 2012 23:26:27 +0000</pubDate><guid>https://www.lantean.co/posts/memory-management-tips/</guid><description>&lt;p&gt;It&amp;rsquo;s REALLY recommended that you set to nil any pointer that has a reference to a released object. But it&amp;rsquo;s tedious, right?. [pointer release]; pointer = nil;.&lt;/p&gt;
&lt;p&gt;Why don&amp;rsquo;t we use a macro instead??&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-objc" data-lang="objc"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;#define LAWipe(x)         [x release]; x = nil;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Simple. Nice. This should help you lower down the BAD_ACCESS crashes!.&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;</description></item><item><title>iOS Singletons</title><link>https://www.lantean.co/posts/ios-singletons/</link><pubDate>Thu, 08 Mar 2012 23:08:53 +0000</pubDate><guid>https://www.lantean.co/posts/ios-singletons/</guid><description>&lt;p&gt;&lt;a href="https://www.lantean.co/wp-content/uploads/2012/03/ios3.jpeg"&gt;&lt;img class="aligncenter size-full wp-image-1066" alt="ios3" src="https://www.lantean.co/wp-content/uploads/2012/03/ios3.jpeg" width="400" height="311" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Suppose that&amp;hellip; for whatever reason, you need to target iOS 3.x. Yes. You need to build an app that should run on any possible device. Or say that&amp;hellip; you simply don&amp;rsquo;t wanna use GCD.&lt;/p&gt;
&lt;p&gt;What&amp;rsquo;s the alternative to write a singleton?&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-objc" data-lang="objc"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;+ (&lt;span style="color:#66d9ef"&gt;id&lt;/span&gt;)&lt;span style="color:#a6e22e"&gt;sharedInstance&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;if&lt;/span&gt;(_instance &lt;span style="color:#f92672"&gt;=&lt;/span&gt; nil)
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; {
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;@synchronized&lt;/span&gt;(self)
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; {
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;if&lt;/span&gt;(_instance &lt;span style="color:#f92672"&gt;==&lt;/span&gt; nil)
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; {
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; _instance &lt;span style="color:#f92672"&gt;=&lt;/span&gt; [[[self &lt;span style="color:#66d9ef"&gt;class&lt;/span&gt;] alloc] init];
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; }
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; }
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; }
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;return&lt;/span&gt; _instance;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;This is a nice alternative to the GCD option. The first time the instance is created, you&amp;rsquo;ll suffer the lag caused by the @synchronized block. But after that. it&amp;rsquo;s just an if. No context switch. No whatsoever! REALLY performant!&lt;/p&gt;</description></item><item><title>iOS Assertions</title><link>https://www.lantean.co/posts/ios-assertions/</link><pubDate>Thu, 08 Mar 2012 23:03:28 +0000</pubDate><guid>https://www.lantean.co/posts/ios-assertions/</guid><description>&lt;p&gt;So&amp;hellip; you write a new piece of code. You run it. Test it. Ship it!. And in two weeks, you end up flooded by iTunes Connect Crash Reports.&lt;/p&gt;
&lt;p&gt;What happened?. It turned out that an attribute parsed from a backend response ended up being a NSString instead of an NSNumber. And it was only after an untested-and-specific-workflow that your application actually used that field.&lt;/p&gt;
&lt;p&gt;How do we prevent this?. ASSERTIONS!. A good friend of mine teached me that&amp;hellip; great software blows everywhere before getting published. If your code works perfectly&amp;hellip; you should be scared!.&lt;/p&gt;</description></item><item><title>Grand Central Dispatch Singletons</title><link>https://www.lantean.co/posts/grand-central-dispatch-singletons/</link><pubDate>Thu, 08 Mar 2012 22:46:41 +0000</pubDate><guid>https://www.lantean.co/posts/grand-central-dispatch-singletons/</guid><description>&lt;p&gt;So&amp;hellip; what&amp;rsquo;s the recommended way (thread safety + performance) to implement a singleton?&lt;/p&gt;
&lt;p&gt;Well.. it looks pretty much like this!&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-objc" data-lang="objc"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;+ (&lt;span style="color:#66d9ef"&gt;instancetype&lt;/span&gt;)&lt;span style="color:#a6e22e"&gt;sharedInstance&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;static&lt;/span&gt; dispatch_once_t pred;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;static&lt;/span&gt; Foo&lt;span style="color:#f92672"&gt;*&lt;/span&gt; bar &lt;span style="color:#f92672"&gt;=&lt;/span&gt; nil;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; dispatch_once(&lt;span style="color:#f92672"&gt;&amp;amp;&lt;/span&gt;pred, &lt;span style="color:#f92672"&gt;^&lt;/span&gt;{ bar &lt;span style="color:#f92672"&gt;=&lt;/span&gt; [[Foo alloc] init]; });
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;return&lt;/span&gt; bar;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</description></item></channel></rss>