Can I create an NSURL that refers to in-memory NSData?

后端 未结 2 1255
借酒劲吻你
借酒劲吻你 2021-02-01 15:46

The docs for NSURL state that:

An NSURL object represents a URL that can potentially contain the location of a resource on a remote server, the path of

2条回答
  •  耶瑟儿~
    2021-02-01 15:56

    What you are missing is the NSURLProtocol class. Takes about three dozen lines of code, and any code that handles URLs properly can access your in-memory data. Read the documentation, it's not difficult and there is sample code available.

    Unfortunately there are some APIs that take an NSURL as a parameter, but can only handle file URLs.

提交回复
热议问题