私はObjective-Cを使ってiOSを開発し始めました。構文に慣れるのに苦労しました。NSDictionaryにフィールド情報を格納する方法を客観的に説明しました。
回答:
回答№1は1//既にすべてのオブジェクトがある
NSString *loginString = @"user1";
NSString *passwordString = @"password1";
NSDictionary *dict = @{@"login":loginString, @"password":passwordString};
//すべてのオブジェクトを持っていない
NSMutableDictionary *mDict = [NSMutableDictionary new];
//When you have loginString you add it to the mDict
[mDict setObject:@"user2" forKey:@"login"];
//When you have passwordString you add it to the mDict
[mDict setObject:@"password2" forKey:@"password"];
回答№2の場合は0
これを試して
NSDictionary *dict=@{@"firstname" : txtAddFirstName.text,
@"lastname" :txtAddLastName.text,
@"region" :txtRegion.text,
@"street" :txtVAddress.text,
@"company" :txtAddCompny.text,
@"city" :txtCity.text,
@"country" : countryCode,
@"postcode" :txtZip.text,
@"telephone" :txtTelephone.text,
@"fax" :txtFax.text,
};