Thursday, April 19, 2012

Clearing NSUserDefaults

I needed to remove all the settings from an app, and there's not an easy built in way to do it.  While it seems like it might, this does not do it:
[NSUserDefaults resetStandardUserDefaults];
But this does:

NSDictionary *settings = [[NSUserDefaults standardUserDefaults] dictionaryRepresentation];
NSArray *keys = [settings allKeys];
for (int i=0; i<[keys count]; i++) {
   NSString *key = [keys objectAtIndex:i];
   [[NSUserDefaults standardUserDefaults] removeObjectForKey:key];
}
[[NSUserDefaults standardUserDefaults] synchronize];

Sunday, April 8, 2012

Google, you're getting worse.

So Google, you can no longer search for something, and then copy the link?  Links now redirect thru your servers(!), and who knows what personal info they may contain, so I'm not ever going to just post one of those redirect links.  You have to click the link, then get redirected to the real webpage you wanted, then copy that URL.  Much more of a pain.

The IDs are much longer in the real URL.
http://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&ved=XXXXX&url=http%3A%2F%2Fftponthego.com%2F&ei=xi-XXXXX&usg=XXXXX&sig2=XXXXX

And in addition to being much more annoying for pasting URLs, it may be only a fraction of a second, but that extra redirect thru your servers takes time.  Google has long pushed speed and quality of results over everything else...but not anymore.  Bing doesn't do this.