Monday, March 29, 2010

NSMailDelivery undeclared

I've been playing around with Objective C using the Cocoa framework ever since I got my Mac for Christmas.

I was following a dummies guide to sending emails using Cocoa and I came across the following show stopper compilation error :

"error: 'NSMailDelivery' undeclared (first use in this function)"

Not much joy online looking for a solution, seems everyone else who was inflicted with this error was advised to use some other mail class due to NSMailDelivery being dropped by Apple with no successor in Cocoa which seemed odd.

Anyway here's how I solved the problem. By default on my Mac Cocoa projects are targeted for a 64 bit architecture environment, when I changed the architecture to 32-bit universal the project compiled.

I changed the target architecture by clicking on the project name under "Groups & Files" to highlight it.
Then I clicked on the "Info" icon to open the project info dialog, next I clicked on the "Build" tab and changed the architecture value to "32-bit Universal".

I'm guessing switching to a 32 bit architecture will fix simular error messages with different classes I saw people enquiring about while I was looking into this problem.

No comments: