0
在我的应用程序中,我想通过iPhone应用程序订购电子商务电子商务产品。我轻松地拿到产品的名字和他们的细节,但同时对产品创建顺序是在HTML页面返回错误:使用iOS应用程序创建订单以施展电子商务
<h1>
TypeError
in Spree::Api::V1::OrdersController#create
</h1>
<pre>can't convert Symbol into Integer</pre>
我要寄给POST请求为:
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];
而且,这个网址我得到从REST api文档的施普雷这是:http://guides.spreecommerce.com/rest.html
另一件事,我想知道什么是在这个网址[line_items] ...另外,如果他们是除了上面的网址之外的任何教程?...在此先感谢。
感谢您的回复...你可以请看看我的参数,因为我认为他们不正确..在这里我发送两个参数... iekey => value(“order [line_items] [0] [variant_id] => 12345“和”order [line_items] [0] [quantity] => 1“)...它们是否合并? – 2012-07-12 07:26:34
等待回复.pls帮助 – 2012-07-12 08:59:16
您在首次发表评论后发布了“等待回复”*一小时*。期待另一个响应立即有点粗鲁。我不是你个人的犯罪。 – 2012-07-12 23:25:24