How to use NSScanner to parse .ics file

后端 未结 1 493
慢半拍i
慢半拍i 2021-02-10 01:53

Could someone please show how i could parse a ics file using NSScanner? (Iphone App)

e.g: if the .ics file was at this URL http://www.ibz.com/data/12345.ics (not a real

相关标签:
1条回答
  • 2021-02-10 02:30

    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!

    0 讨论(0)
提交回复
热议问题