【问题标题】:HTTPS request - get document on iOSHTTPS 请求 - 在 iOS 上获取文档
【发布时间】:2012-10-01 09:07:40
【问题描述】:

我有文档链接(例如:https://example.com/test/test.pdf)。我曾尝试使用ASIHTTPRequest,但它不起作用。我知道我可以通过使用NSURL 来获取它,但是还有其他方法或框架吗?

【问题讨论】:

    标签: ios httprequest


    【解决方案1】:

    你不能只用NSURL获取文档的内容,NSURL是url的表示,你必须做请求。

    这里有一些元素:iPhone SDK: How do you download video files to the Document Directory and then play them?

    【讨论】:

      【解决方案2】:

      你应该在这里使用 NSURLConnection。 See documentation on it.

      【讨论】:

        【解决方案3】:

        这里是如何处理 STHTTPRequest https://github.com/nst/STHTTPRequest

        __block STHTTPRequest *r = [STHTTPRequest requestWithURLString:@"https://example.com/test/test.pdf"];
        
        r.completionBlock = ^(NSDictionary *headers, NSString *body) {
            NSData *pdfData = r.responseData;
        };
        
        r.errorBlock = ^(NSError *error) {
            //
        };
        
        [r startAsynchronous];
        

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 2021-03-20
          • 2013-12-09
          • 2018-05-31
          • 2013-08-04
          • 2017-10-22
          • 2016-09-08
          • 1970-01-01
          • 1970-01-01
          相关资源
          最近更新 更多