That line is a bit of cleverness that creates a string like the following:
m...@my-other-machine.local:4000 (if a port is specified)
m...@my-other-machine.local (if no port)
The middle expression chooses between two format strings (@"…"). The first
one requires three arguments (each represented by “%@”); the second
It's not, strictly speaking, an error to pass more arguments than the
format string requires, but it can be caused by changing either the format
string or the argument list (in this line, that's “username, hostname,
port”) and forgetting to change the other.
The cleverness here is in *deliberately* passing more arguments than the
second format string requires, since the first format string will use all
three and the second format will simply ignore the extra argument.
The code is correct, but the compiler is not wrong, and ignoring warnings
is a good way to create problems later—if somebody makes the aforementioned
change-one-but-not-the-other mistake in a later change, the warning will
not suddenly appear because it was already there, so the person making the
change may not discover their mistake.
The correct change to satisfy the compiler and make that code more robust
against future changes would be to have an if statement that selects
between two assignments, each with a different stringWithFormat: message on
the right side.