How to use NSScanner to parse .ics file

﹥>﹥吖頭↗ 提交于 2019-12-03 08:52:51

Code examples to do this completely and well would be quite extensive, and SO isn't the place for large sample applications. With that in mind, the general solutions would be:

  1. Use a NSURLRequest and NSURLConnection to get an HTTP connection to download the file; store it as an NSData object built during delegate calls from the NSURLConnection. Once it's completely downloaded, convert it to an NSString for parsing. The URL Loading System Programming Guide has a number of examples - look for NSURLConnection and asynchronous requests.
  2. To parse the .ics file (which at this point is available as an NSString), you'll first need to figure out the expected format of the file. Wikipedia seems to have a couple examples of how .ics files store data. Basically you'll want to go through and scan strings separated by the various separators the file format uses (looks to be mostly colons).

If you have more specific questions, you'll probably get much more specific answers - give it a shot and ask more if you get stuck!

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