私のアプリでは、iPhoneアプリでまくるeコマースで商品を注文したいと考えています。製品名とその詳細を簡単に取得できますが、製品の注文を作成しているときに、html ページでエラーが返されます。
<h1>
TypeError
in Spree::Api::V1::OrdersController#create
</h1>
<pre>can't convert Symbol into Integer</pre>
投稿リクエストを次のように送信しています:
NSString *str = [NSString stringWithFormat:@"http://localhost:3000/api/orders"];
NSURL *urlForBuy = [NSURL URLWithString:[str stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:urlForBuy];
NSString *idVariant = [NSString stringWithFormat:@"order[line_items][%d][variant_id]",0];
NSString *qnty = [NSString stringWithFormat:@"order[line_items][%d][quantity]",0];
NSString *idVariantValue = @"123456";
[request setPostValue:[NSString stringWithFormat:@"%d",[idVariantValue intValue]] forKey:idVariant];
[request setPostValue:[NSString stringWithFormat:@"%d",1] forKey:qnty];
[request setPostValue:@"<my admin token>" forKey:@"token"];
[request setRequestMethod:@"POST"];
[request setDelegate:self];
[request setDidFinishSelector:@selector(buyResponse:)];
[request setDidFailSelector:@selector(buyResponse_failed:)];
[networkQueue addOperation:request];
[networkQueue go];
また、この URL は Spree の REST API ドキュメントから取得します: http://guides.spreecommerce.com/rest.html
この URL の [line_items] が何であるかを知りたいもう 1 つのこと...また、上記の URL 以外のチュートリアルがある場合は?...よろしくお願いします。