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

Mockup & CodeGen, iPhone & iPad
($9.99)

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

Manu
($0.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 03-20-2010, 10:50 AM   #1 (permalink)
Obj-C Learner
 
Join Date: Apr 2009
Location: Manchester, UK
Posts: 1,030
Send a message via MSN to ZunePod Send a message via Yahoo to ZunePod
Default Unrecognized selector sent to instance

Code:
[fileTemplate writeToFile:writablePath atomically:YES encoding:NSUTF8StringEncoding error:NULL];
This is the line in question.

Just for clarity:

Code:
fileTemplate = [NSString stringWithFormat:@"<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n<html xmlns=\"http://www.w3.org/1999/xhtml\">\n<head>\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" />\n<title>Untitled Document</title>\n</head>\n\n<body>\n</body>\n</html>"];
and

Code:
WritablePath = [NSString stringWithFormat:@"/Users/Prince/Library/Application Support/iPhone Simulator/3.2/Applications/3A8069CB-526D-4F65-9F29-8939B250431E/Documents/Project/index.txt"];
Obviously WritablePath uses a different way to get the path, but I NSLogged it, and got that...
__________________
Will code for food
ZunePod is offline   Reply With Quote
Old 03-20-2010, 11:01 AM   #2 (permalink)
Registered Member
 
Join Date: Dec 2008
Location: UK
Posts: 1,886
Default

Check your capitalisation, you're passing "writablePath" with a lowercase w, yet your NSString pointer is "WritablePath" with an uppercase w.

Also, you don't have to use stringWithFormat unless you're actually formatting something.
For example, you can just use:
Code:
WritablePath = @"/Users/Prince/Library/Application Support/iPhone Simulator/3.2/Applications/3A8069CB-526D-4F65-9F29-8939B250431E/Documents/Project/index.txt";
harrytheshark is offline   Reply With Quote
Old 03-20-2010, 11:15 AM   #3 (permalink)
Obj-C Learner
 
Join Date: Apr 2009
Location: Manchester, UK
Posts: 1,030
Send a message via MSN to ZunePod Send a message via Yahoo to ZunePod
Default

Quote:
Originally Posted by harrytheshark View Post
Check your capitalisation, you're passing "writablePath" with a lowercase w, yet your NSString pointer is "WritablePath" with an uppercase w.

Also, you don't have to use stringWithFormat unless you're actually formatting something.
For example, you can just use:
Code:
WritablePath = @"/Users/Prince/Library/Application Support/iPhone Simulator/3.2/Applications/3A8069CB-526D-4F65-9F29-8939B250431E/Documents/Project/index.txt";
Ah, that would throw me a compile error, I just had to edit the method names because some people wouldn't approve.

I'll try that thing.
__________________
Will code for food
ZunePod is offline   Reply With Quote
Old 03-20-2010, 11:17 AM   #4 (permalink)
Obj-C Learner
 
Join Date: Apr 2009
Location: Manchester, UK
Posts: 1,030
Send a message via MSN to ZunePod Send a message via Yahoo to ZunePod
Default

It worked, I have no idea why though.

How would I check when the operation has been completed?
__________________
Will code for food
ZunePod is offline   Reply With Quote
Old 03-21-2010, 12:49 PM   #5 (permalink)
Registered Member
 
Join Date: Dec 2008
Location: UK
Posts: 1,886
Default

It returns a BOOL, so you can use:
Code:
BOOL didSucceed = [whatever writeToFile...];
if (didSucceed){
    NSLog(@"yep");
}
harrytheshark 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: 267
17 members and 250 guests
ADY, Alsahir, dacapo, Dani77, Desert Diva, Duncan C, F_Bryant, Grinarn, HemiMG, jansan, linkmx, M@realobjects, macquitzon216, prchn4christ, smethorst, spiderguy84
Most users ever online was 1,187, 10-11-2011 at 08:09 AM.
» Stats
Members: 158,882
Threads: 89,228
Posts: 380,761
Top Poster: BrianSlick (7,129)
Welcome to our newest member, jansan
Powered by vBadvanced CMPS v3.1.0

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