Search Apple App store by genre with iOS/Obj-c

笑着哭i 提交于 2019-11-30 14:25:01

问题


How would you use Obj-c to search the Apple App store to do the following...

  1. Return the details of the top 100 in the games overall category or a specific games category
  2. Return the details of a specific games in the games category

Anyone?


回答1:


Well, as far as I know you have two methods to search the App Store:

  1. Search API;
  2. RSS feed generator.

There are many differences between those but the most relevant for your example is that with the Search API you cannot sort the results as they come sorted by relevance and it requires always a search term. The RSS feed generator already has Top Free, Top Paid and Top Grossing categories for you.

Given this I'm going to start answering your question for the RSS feed generator.

  1. You use the RSS feed generator to generate feeds like this for the top 100 free games in the US store: https://itunes.apple.com/us/rss/topfreeapplications/limit=100/genre=6014/xml;
    • Take a loot at this link to get games sub genres;
  2. You use NSXMLParser library to parse the RSS which already includes the app details.
    • You may use the initWithContentsOfUrl: method of NSXMLParser;
    • A quick how-to for this part can be found here.

You can also use StoreKit to get the details of the apps by their ID or show a modal view controller with a specific app but that will require an extra network request.


For the sake of completeness I'll also cover how you can use the Search API.

  1. Use the Search API to create a URL that describes your search:
    • A URL like this allow you to search for apps with that matches "angry birds" - https://itunes.apple.com/search?term=angry+birds&media=software.
  2. Process the results using NSJSONSerialization library. That already includes the app details.
    • Take a loot at this tutorial on how to use the NSJSONSerialization library.

In the end, as @Numan said, this two methods accomplish different things. You said you wanted to have the top 100 games from a specific category and also said you needed to search for a specific game.

You can use my descriptions to create one class that interacts with the App Store in these two ways and return an object defined by you that describes an app (or an array of objects).




回答2:


You can access this info by RSS, look here http://www.apple.com/rss/

Also you can generate RSS feed http://itunes.apple.com/rss/generator/



来源:https://stackoverflow.com/questions/13833521/search-apple-app-store-by-genre-with-ios-obj-c

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!