Thursday, June 30, 2011

How to View HTML Source Code from UIWebView

While debugging a sudden Facebook iOS library defect (Blank Dialog presented), I needed to check the HTML code received from Facebook server. This is how to do it:

- (void)webViewDidFinishLoad:(UIWebView *)webView
{
   NSLog(@"%@",
    [webView stringByEvaluatingJavaScriptFromString:
    @"document.body.innerHTML"]);
}
Let's hope Facebook will quickly fix their faulty server-side code - and next time do better testing before a release...

Friday, June 17, 2011

Why Xcode Can't Find My Connected Device

There are many ways to fail launching an application in your device. This was a new one!

iPhone is running iOS 4.1, but project "Deployment Target" is set to 4.3. As result this project does not show your device in Scheme list. Switch to another project with a compatible deployment target and your device is on the list!

Xcode4 completely failed to help debugging this case, in all possible ways.

Tuesday, June 14, 2011

How to Find Unlocalized Strings

How to make sure you have localized all text strings in your application? You check it manually once - and then change the code. Is everything still localized? Did someone else in team just touch the code?

Fortunately Apple Xcode team comes to rescue!

Monday, June 13, 2011

CocoaHeads Helsinki #2

The second CocoaHeads Helsinki meetup was held last Thursday 9 June 2011 at MK&C office. There was only about 10 persons present, since WWDC was going on elsewhere.

We still had good time, nobody missed WWDC. Yep :)

Thursday, June 9, 2011

Testing TestFlight

Started last night beta testing my few small but simple applications. In past I've done ad hoc releases and distribution manually and was not really looking forward to do it again.

Then I was told about TestFlight. It's beatiful. It's user-friendly. It works. And then some more!

Monday, June 6, 2011

How to Clear Project Build Results

You have a project with several targets, of which at least one fails. You can see this at Xcode4 iTunes-styled toolbar info window at top.

Except that The Target that you just build was just fine. No warnings, no errors. Xcode4 still tells something went wrong!

Sunday, June 5, 2011

NSTimeInterval as Not a Number

This is something very simple. Took me a long time and several attempts to find the answer, most likely because I wasn't able to phrase the question in the correct way.

Anyway - occasionally you are dealing with a NSTimeInterval, which happen to have value Not a Number.

Debugger shows "nan", google search finds "NaN, but the correct answer is "NAN":
if (aTimeInterval == NAN)
{
    // don't use timeInterval
}
Sometimes the most important thing is asking the right questions.