Sometimes it’s useful to quickly see all the subviews of an iPhone view.

Perhaps you’re debugging a problem in one of your views or trying to understand the inner workings of one of the built in views.

You can simply iterate over a view’s subviews, but then you won’t see subviews deeper than one level. You need a method that recursively walks the hierarchy.

Luckily Apple has already done this with an undocumented UIDebugging category on UIView that makes this very easy: recursiveDescription

At the gdb prompt in the Xcode debugger you can say:

p [[self view] recursiveDescription]

and instantly see a description of the entire view hierarchy.

Follow me on Twitter

Did you know that it’s possible to remove someone from your followers without blocking them?

Normally when you visit your list of followers these are the options available to you:

No Remove option
But after you protect your twitter account and mark it private, the options change to include the remove option:

Remove a follower

Selecting “Remove” shows this alert and after you click OK, poof that user is no longer following you:

Confirm removing a follower

This nifty option is also available from the API, though it is undocumented:

curl -u user:password -d ” http://twitter.com/friendships/destroy/59648642.xml

Here is a patch to John Nunemaker’s Twitter gem that adds this functionality:

module Twitter
  class Base
    def friendship_remove(id)
      perform_post(“/friendships/remove/#{id}.xml”)
    end
  end

And here is a quick Ruby Script that removes all the followers of a user:

#!/usr/bin/ruby -rubygems
require ‘twitter’

module Twitter
  class Base
    def friendship_remove(id)
      perform_post(“/friendships/remove/#{id}.xml”)
    end
  end

auth = Twitter::HTTPAuth.new(‘user’, ‘password’)
twitter = Twitter::Base.new(auth)

twitter.follower_ids.each do |follower_id|
  begin
    twitter.friendship_remove(follower_id)
  rescue => err
    puts “#{err} for follower #{follower_id}”
    next
  end
end

Follow me on Twitter

It looks like Twitter is making lots of little changes on their site.

They’ve added new colorful default profile imagesrolled out some design tweaks and now they allow the @ symbol in URLs.

Previously if you tried twitter.com/@boctor or twitter.com/@tweetslounge you’d get an error. But now that link works just fine.

Handy for those times you’re copying and pasting and accidentally keep the  symbol

A welcome change from the brown!

Follow us on Twitter

If you’ve used Twitter at all you’ve seen the original default profile image that Twitter assigns you when you first join:

Default Profile Image

Now it looks like along with their home page redesign they have a set of new images. It appears that the colors are randomly assigned:

Default profile 1 Default profile 2 Default profile 3
Default profile 4 Default profile 5 Default profile 6

A welcome change from the brown!

Follow us on Twitter

I’m happy to announce my new side project: Tweets Lounge.

Tweets Lounge is a directory of local neighborhood businesses using Twitter. It’s like a Yelp directory for Twitter.

We’re initially supporting Seattle and the surrounding area, but we plan on expanding to other cities soon. Check out the site: http://tweetslounge.com and follow us at @TweetsLounge.

Apple released an iPhone app for this year’s WWDC. You can download the app from the WWDC attendee site.

The instructions are to download the zip file, drag the app and the provisioning profile to iTunes then sync your phone.

If you’d like to install the WWDC app on a device that isn’t setup for iTunes syncing, then you can use Xcode instead of iTunes. Here are the steps:

1. Download the zip file. Expand it and you’ll see two files: WWDC09.app and a .mobileprovision file.

2. Launch Xcode and open the Organizer (Window -> Organizer)

3. Select your iPhone/iPod Touch in the organizer window.

4. In the Provisoning section click the + under the list of provision files and select the WWDC app’s provision file you downloaded.

5. In the Applications section click the + under the list of Applications and select the WWDC09.app you downloaded.

When Xcode is done, the WWDC09 app will be installed on your device.

When you show web content in a UIWebView, links that open a popup do nothing.

This makes sense. Since UIWebView is an embedded control in your app, there is no logical default for popups.

So how will users view those pages? The solution is to convert all popups to normal links before displaying the web page:

-(void) webViewDidFinishLoad:(UIWebView *)wv
{
    [wv stringByEvaluatingJavaScriptFromString:@"\
    links = document.getElementsByTagName('a');\
    for (i=0; i<links.length; i++) {\
        links[i].target = '_self';\
    }"];
}

Update (7/21/09): TweetDeck finally speaks up about this issue, offers the same exact advice as below: http://tweetdecksupport.posterous.com/fixing-the-blank-tweetdeck-problem?

Yesterday I launched TweetDeck to get my Twitter fix and was surprised to see TweetDeck stuck with a blank empty screen:

TweetDeck stuck, launches blankSearching around I discovered that there are two places where TweetDeck stores it’s data:

Preferences Folder

  • This contains preferences like your columns, layout, etc.
  • To find this folder go to your Home directory -> Library folder -> Preferences folder then find the folder that starts with TweetDeck.
  • The actual path on my machine is:
    ~/Library/Preferences/TweetDeckFast.F9107117265DB7542C1A806C8DB837742CE14C21.1

Adobe AIR Encrypted Local Store (ELS)

  • This contains your login info to Twitter
  • To find this folder go to your Home directory -> Library folder -> Application Support folder -> Adobe folder -> AIR folder -> ELS folder then find the folder that starts with TweetDeck
  • The actual path on my machine is:
    ~/Library/Application Support/Adobe/AIR/ELS/TweetDeckFast.F9107117265DB7542C1A806C8DB837742CE14C21.1

I tried moving/deleting the Preferences folder, but that did nothing. I ended up deleting the Adobe AIR ELS folder and leaving the Preferences folder as is. TweetDeck asked me for my Twitter credentials again, but then everything was back to normal, including all of my preferences.

If you are on Windows you can find these folders here (courtesy Christopher Grant):

  • C:\Documents and Settings\[user]\Application Data\TweetDeckFast.[guid]
  • C:\Documents and Settings\[guid]\Application Data\Adobe\AIR\ELS\TweetDeckFast.[guid]

I’m used to taking screenshots using Xcode, part of Apple’s iPhone SDK.

So it was news to me that ever since the 2.0 firmware, you can take screenshots directly on your  iPhone:

Press and hold the Home button (round button on the front) then click the Sleep/Wake button (small button on top of the iPhone).

You’ll hear the camera sound and the screen will flash. Launch the Photos app and you’ll see your new screenshot in the Camera Roll.

A lot of iPhone applications need to convert a user’s location from the latitude/longitude that the iPhone SDK returns into a postal code. This is primarily because a lot of APIs still use postal codes to look up information. This is the case for Hot Popcorn where we look up movie times using either a postal code or city, state.

The popular choice for doing this conversion is GeoNames, a web service run by Marc Wick free of charge under a creative commons attribution license. When an API is free, there have to be limits to set to prevent abuse. GeoNames limits usage in it’s terms of service to 50,000 requests per IP address per day.

But this is a new world with rich clients like the iPhone, each with their own IP addreess. So what happens when a free popular iPhone game like iMob uses GeoNames? Mayhem.

iMob Online is currently #5 in the Top Free Apps on iTunes and this has essentially brought down GeoNames:

The problem since yesterday evening is an enormously popular iphone application called iMob. It is hammering the server with > 100 requests per second which has the effect of a DDOS attack. I am trying to get in touch with the developers to have them remove this feature from their application.

This forced Marc to take down the server:

We have temporarily removed the domain ws.geonames.org from the dns setting to protect the server from exessive use by an iphone application. You can access the server with the domain ws5.geonames.org

Now any iPhone application trying to use GeoNames will fail. Thanks iMob!

Follow

Get every new post delivered to your Inbox.