如何在Research Kit中使用contentURL来预编写在线PDF文件?

时间:2016-07-27 07:31:22

标签: researchkit

我一直在研究名为ORKTest的研究套件示例的源代码:

if (type.integerValue == ORKConsentSectionTypeDataGathering) {
        /*
         Tests PDF content instead of text, HTML for Learn More.
         */
        NSString *path = [[NSBundle mainBundle] pathForResource:@"SAMPLE_PDF_TEST" ofType:@"pdf"];
        consentSection.contentURL = [NSURL URLWithString:path];

    }

它在.contentURL中使用了本地PDF文件路径,我想将其替换为在线PDF网址,例如http://examle.com/file/example.pdf

consentSection.contentURL = NSURL.fileURLWithPath("http://example.com/file/example.pdf")

    consentSection.contentURL = NSURL.fileURLWithPath("example.com/file/example.pdf")

但只有一个空页面(我使用的网址在浏览器上工作正常,只是一个pdf文件)。

有人有任何想法吗?

1 个答案:

答案 0 :(得分:0)

NSURL.fileURLWithPath仅适用于本地文件。你必须把它放在应用程序的沙箱中,然后让consentSection加载它。