私は少しjsonエンコードの問題があります:
phpサーバーに送信する前にオブジェクト形式のJSONをSBJSONでエンコードする必要があります。現時点では、このサンプルコードは機能します。
NSArray *arrayData = [NSArray arrayWithObjects:
user.id == nil ? [NSNumber numberWithInt:-1] : user.id,
ProfessionField.text, NameField.text, RPPSField.text, RPPSField.text,
NameField.text, SurnameField.text, StreetField.text,
TownField.text, CpField.text, MailField.text,
PhoneField.text, FaxField.text, MobileField.text,
// [user.horaires JSONRepresentation],
nil];
NSArray *arrayKey = [NSArray arrayWithObjects:
@"id", @"spe", @"name", @"rpps", @"cip",
@"name", @"surname", @"rue",
@"ville", @"cp", @"mail",
@"tel", @"fax", @"port",
// @"horaires",
nil];
NSDictionary *dataBrut = [NSDictionary dictionaryWithObjects:arrayData forKeys:arrayKey];
NSDictionary *jsonDict = [NSDictionary dictionaryWithObject:dataBrut forKey:@"data"];
NSString *jsonRequest = [jsonDict JSONRepresentation];
問題は、このオブジェクトのJSON表現で「user.horaires」(ここではコメント)アプリケーションCRASHを送信する必要がある場合です。
このオブジェクトは、次のクラスの配列です。
@interface Horaire : NSObject
{
BOOL morning;
}
@property (nonatomic, strong) NSNumber *id;
@property (nonatomic, strong) NSString *open;
@property (nonatomic, strong) NSString *close;
誰かがこれをエンコードするのに成功する方法を知っていますか?