Reputation: 1527
I have a problem with creation to NSString. The error is: "error: expected ']' before numeric constant". The code is below. Can you help me to find a solution for create these?
NSString *titleXML = [NSString stringWithFormat:@"<?xml version="1.0" encoding="UTF-8"?>"];
Upvotes: 1
Views: 654
Reputation: 12800
You'll need to escape those double quotes in the string for it to work. Like so:
NSString *titleXML = [NSString stringWithFormat:@"<?xml version=\"1.0\" encoding=\"UTF-8\"?>"];
Upvotes: 1
Reputation: 411350
You have to escape your double quotes in the string using \"
:
NSString *titleXML = [NSString stringWithFormat:@"<?xml version=\"1.0\" encoding=\"UTF-8\"?>"];
Upvotes: 1
Reputation: 77291
You have quote characters embedded in your string, you need to escape them with backslash like this:
NSString *titleXML = [NSString stringWithFormat:@"<?xml version=\"1.0\" encoding=\"UTF-8\"?>"];
Upvotes: 1
Reputation: 2266
You need to escape the quotes in your string. Try it like this
NSString *titleXML = [NSString stringWithFormat:@"<?xml version=\"1.0\" encoding=\"UTF-8\"?>"];
Upvotes: 5