JSON + AFNetworking [关闭]
Posted
技术标签:
【中文标题】JSON + AFNetworking [关闭]【英文标题】:JSON + AFNetworking [closed] 【发布时间】:2013-05-12 18:42:15 【问题描述】:我从使用 Event Espresso 的 WP 获得以下 JSON。我想提取一些信息,例如 Event's name、Venue 和 Datetimes。我也想使用AFNetworking
来实现它。
"status": "OK",
"status_code": 200,
"body":
"Events": [
"id": 1,
"code": "1-5123548",
"name": "Name of Event",
"description": "some description here",
"status": "active",
"limit": 500,
"group_registrations_allowed": false,
"group_registrations_max": 5,
"active": true,
"member_only": false,
"virtual_url": "",
"call_in_number": "",
"phone": "",
"metadata":
"default_payment_status": "Incomplete",
"venue_id": 1,
"additional_attendee_reg_info": "2",
"add_attendee_question_groups":
"1": "1"
,
"date_submitted": "March 12, 2013",
"event_thumbnail_url": "/../auditing-photo-150x150.jpg",
"event_hashtag": "",
"event_format": "",
"event_livestreamed": "",
"": ""
,
"Datetimes": [
"id": 93,
"is_primary": true,
"event_start": "2013-03-15 10:00:00",
"event_end": "2013-03-16 17:00:00",
"registration_start": "2013-01-01 08:00:00",
"registration_end": "2013-03-21 17:00:00",
"limit": 500,
"tickets_left": 500
],
"Venues": [
"id": 1,
"name": "Menara SSM",
"identifier": "1-513f488c788a2",
"address": "No. 7, Jalan Stesen Sentral 5",
"address2": "Kuala Lumpur Sentral",
"city": "Kuala Lumpur",
"state": "Federal Territory of Kuala Lumpur",
"zip": "50623",
"country": "Malaysia",
"user": 1
],
"Categories": [
"id": 3,
"name": "category",
"identifier": "a",
"description": "",
"user": 1
],
"Prices": [
"id": 73.2,
"name": "Registration Fee",
"amount": 500,
"description": null,
"limit": 500,
"remaining": 500,
"start_date": null,
"end_date": null,
"Pricetype":
"id": 4,
"name": "Member Price",
"is_member": true,
"is_discount": false,
"is_tax": false,
"is_percent": false,
"is_global": true,
"order": 0
]
]
希望有人可以帮助提出一种方法来做到这一点。在 Objective-C 上相当新。提前致谢。
【问题讨论】:
【参考方案1】:AFNetworking 教程 - http://www.raywenderlich.com/30445/afnetworking-crash-course JSON 教程 - http://www.w3schools.com/json/
查看本教程后,您可以实现自己的代码,之后如果遇到问题,您可以回到 SO 提出更多问题。
【讨论】:
以上是关于JSON + AFNetworking [关闭]的主要内容,如果未能解决你的问题,请参考以下文章
iOS,AFNetworking - 带有 JSON 响应的“清除”NSSTring [关闭]
iOS开发过程中,遇到解析的json数据为<null>,进行赋值时会导致崩溃,使用AFNetworking可以这样解决。