Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Binju

macrumors member
Original poster
Jan 31, 2010
65
0
Can you find the syntax error?

Code:
[["%@" writeToFile:@"/NSLog.txt" atomically:YES encoding:[NSUTF8StringEncoding error:nil]],movieFile] ;
 
Can you find the syntax error?

Code:
[["%@" writeToFile:@"/NSLog.txt" atomically:YES encoding:[NSUTF8StringEncoding error:nil]],movieFile] ;

More a massive conceptual error. You are assuming that, somehow, possibly by magic, the compiler will let you use the return of
Code:
["%@" writeToFile:@"/NSLog.txt" atomically:YES encoding:[NSUTF8StringEncoding error:nil]]
as an object that you can call a method on without giving the method name. What you do pass it is ",movieFile" which is not a valid method call.

I think what you are trying to do is us
Code:
"%@"
as a format string and have movieFile be the argument to that format. But your code is nothing even close to that: look at the stringWithFormat: method in NSString and use it.
 
Code:
[[NSString stringWithFormat:@"%@", movieFile] writeToFile:@"/NSLog.txt" atomically:YES encoding:[NSUTF8StringEncoding error:nil]];
 
Code:
[[NSString stringWithFormat:@"%@", movieFile] writeToFile:@"/NSLog.txt" atomically:YES encoding:[NSUTF8StringEncoding error:nil]];

You still have a meaningless set of square brackets around the result that the compiler will try and turn into a method call and fail.

I suggest you take two steps back and read up on the basics of Objective-C before trying to write any code as it's clearly you fundamentally don't understand what you are doing.
 
Code:
NSString *urlString = [movieURL absoluteString];
	[urlString writeToFile: @"/myfile.txt" atomically: YES encoding:NSUTF8StringEncoding error:nil];
 
Code:
NSString *urlString = [movieURL absoluteString];
	[urlString writeToFile: @"/myfile.txt" atomically: YES encoding:NSUTF8StringEncoding error:nil];

What is your question?

We can't read your mind.

If you want to know "Does it compile?", then you should compile it and see.

If you have another problem, then you must describe the problem.
 
Code:
NSString *urlString = [movieURL absoluteString];
	[urlString writeToFile: @"/myfile.txt" atomically: YES encoding:NSUTF8StringEncoding error:nil];

This works
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.