Today I’ll show how to parse date from RSS feed to NSDate in iPhone application.
When processing several RSS feeds, it is usual task to arrange and sort them by date. Therefore text representation of date need to be transformed to NSDate.
My googling of solutions for this issue resulted in use of [NSCalendarDate dateWithNaturalLanguageString:string] function. As I wrote before, NSCalendarDate is not supported under iPhone OS, so this way lacks.
Another way is to parse date via NSDateFormatter, but I didn’t find any full solution. So let’s write it :)
Read more…
iPhone
development, iPhone, Objective-C
A week ago I found some annoying thing about iPhone OS and iPhone simulator. As a result you cannot be really sure that application that works great on simulator whould even be compiled for device.
Unpretty thing that I found is that NSCalendarDate and NSURLDownload classes are not supported on iPhone OS. But they are do supported on simulator! Code is not compiled in device mode with error that class is unknown. Seems to be a simulator bug :(
Please, be careful, and do not use NSCalendarDate and NSURLDownload. Also test your application on a device regularly. If you do not have a device, just build your app (Cmd-B) in device mode, to be sure it is successfully compiled.
iPhone
development, iPhone, Objective-C, tricks
Few month ago I started to develop iPhone application for a new customer. Having a lot of .NET experience before (and no Objective-C experience), I was discouraged with absence of garbage collector. Yep, garbage collection is unfortunately not supported under iPhone OS, it is supported only under Mac OS X. Dealing with manual memory allocation/deallocation, releasing/retaining/autoreleasing took time in researches until I’ve reached a good article at stepwise.com. In a bit of information are described common memory management rules and common mistakes. Here it is:
Very simple rules for memory management in Cocoa
For more information please use Apple document Memory Management Programming Guide for Cocoa.
iPhone
development, iPhone, memory, Objective-C