Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > Mac OS X Development Forums > Objective-C, Python, Ruby Development

Reply
 
LinkBack Thread Tools Display Modes
Old 03-07-2011, 04:11 PM   #1 (permalink)
Registered Member
 
Vermillion's Avatar
 
Join Date: Mar 2011
Location: Bolivia
Age: 20
Posts: 54
Vermillion is on a distinguished road
Default 'NSUTF8Encoding' Undeclared?

Hi guys, I'm reading this book called "Programming Objective-C 2.0" by Stephen G. Kochan. In chapter 20, he put the following snippet:

Code:
#import <Foundation/Foundation.h>

int main (int argc, const char * argv[])
{
    NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
	
	NSDictionary *glossary =[NSDictionary dictionaryWithObjectsAndKeys:
							 @"Class declared so other classes can be inherited from it.",
							 @"abstract class",
							 @"To implement all the methods defined in a protocol.",
							 @"adopt",
							 @"Storing an object for later use.",
							 @"archiving",
							 nil
							 ];
	
	if([glossary writeToFile:@"glossary" atomically:YES encoding:NSUTF8Encoding error:nil] == NO)
	{
		NSLog(@"Save to file failed.");
	}
	
    [pool drain];
    return 0;
}
But when I try to compile it, it says NSUTF8Encoding is undeclared. I have copied the example twice with no luck. Can someone tell me a good fix for this issue? I don't want to skip the chapter because it's quite important.

EDIT: It also says glossary may not respond to the writeToFile:atomically:encoding:error: method. WTF.

Last edited by Vermillion; 03-07-2011 at 04:26 PM.
Vermillion is offline   Reply With Quote
Old 03-07-2011, 11:55 PM   #2 (permalink)
Registered Member
 
Vermillion's Avatar
 
Join Date: Mar 2011
Location: Bolivia
Age: 20
Posts: 54
Vermillion is on a distinguished road
Default

Sorry for the double post, but for those wondering, it was a mistake from the book. The specified method is not that big, and I solved this buy checking the errata for the book.
Vermillion is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 486
15 members and 471 guests
7twenty7, AlanFloyd, AppsBlogger, David-T, iAppDeveloper, imac74, Jaxen66, lovoyl, Music Man, mutantskin, Paul Slocum, SLIC, solardrift, unicornleo, usernametaken
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,683
Threads: 94,131
Posts: 402,932
Top Poster: BrianSlick (7,990)
Welcome to our newest member, unicornleo
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 10:13 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0