Can't get rid of a build error, need Objective-C help


I’m trying to do the Geocode challenge and am running into a dumb problem which I can’t resolve.

I KNOW this is my newness to Objective-C, I’m not understanding some syntax nuance.

Here is the problem code:

NSString *subTitleString = [[NSString alloc] initWithFormat:@"%@, %@", [ptrPMK locality], [ptrPMK countryCode]]; MapPoint *mp = [[MapPoint alloc] initWithCoordinate:[ptrLocation coordinate] title:[locationTitleField text] subtitle:subTitleString];

When I build this, I get a failure “Expected ‘:’ before ‘]’ token”, at the line “subtitle:subTitleString];” Subtitle is defined as an (NSString *) in the MapPoint declaration.


I think I figured it out. I should put subTitleString inside parenthesis?


What has me confused is that in the RandomPossessions exercise, we had a code fragment that looked like:

[code] NSString *randomSerialNumber = [NSString stringWithFormat:@"%c%c%c%c%c",
‘0’ + random() % 10,
‘A’ + random() % 26,
‘0’ + random() % 10,
‘A’ + random() % 26,
‘0’ + random() % 10];

Possession *newPossession = [[self alloc] initWithPossessionName:randomName 


I’m not understanding the difference. Why do we need () in one case, but not in the other?