PDA

View Full Version : appendString (arguments?) problem




Simplicated
Jan 11, 2009, 10:09 AM
I can't describe my problem... Please help me.

for (AppController *entryToPrint in candidates) {
[htmlString appendString:@"%@", entryToPrint];
}

It gives warning and the program won't run.

Thank you very much.



BorgCopyeditor
Jan 11, 2009, 10:20 AM
I can't describe my problem... Please help me.

for (AppController *entryToPrint in candidates) {
[htmlString appendString:@"%@", entryToPrint];
}

It gives warning and the program won't run.

Thank you very much.

What warning does it give? What is the value of htmlString inside your method? (You can find out by setting a debugger breakpoint on this line, and looking at its value before executing the line.) Is it in scope inside your method? Has it been declared, but not initialized?

kainjow
Jan 11, 2009, 11:14 AM
Use appendFormat: instead.

gnasher729
Jan 11, 2009, 11:21 AM
I can't describe my problem... Please help me.

for (AppController *entryToPrint in candidates) {
[htmlString appendString:@"%@", entryToPrint];
}

It gives warning and the program won't run.

If you can't describe the problem, that is a problem.

You say "It gives warning". Who or what is "it"? What warning? Maybe you could copy the warning into your message? How is anyone supposed to know what the problem is if you don't say which warning?

You say "program won't run". Does that mean you can't start it, or does it crash, or does it not do what you want it to do?

One hint: Double click an appendString, then "Lookup selected text in API reference".

BorgCopyeditor
Jan 11, 2009, 12:58 PM
I can't describe my problem... Please help me.

for (AppController *entryToPrint in candidates) {
[htmlString appendString:@"%@", entryToPrint];
}

It gives warning and the program won't run.

Thank you very much.

What about this:[htmlString appendString:[entryToPrint description]];