I have an application in which i am loading a pdf from the bundle by using
CFURLRef pdfURL = CFBundleCopyResourceURL(CFBundleGetMainBundle(), CFSTR("hhhh.pdf"), NULL, NULL);.
Now i want to load it from my web server. I was done it with a string url using
NSString *strUlr = [NSString stringWithFormat:@"https://s3.amazonaws.com/hgjgj.pdf"];
CFStringRef aCFString = (CFStringRef)strUlr;
//CFURLRef pdfURL = aCFString;
// NSURLRequest *requestObj = [NSURLRequest requestWithURL:url];
//pdf = CGPDFDocumentCreateWithURL((CFURLRef)pdfURL);
CFURLRef pdfURL = CFBundleCopyResourceURL(CFBundleGetMainBundle(),aCFString, NULL, NULL);
pdf = CGPDFDocumentCreateWithURL((CFURLRef)pdfURL);
NSLog(@"%@",pdf);
//CFRelease(pdfURL);
but with no success..Can anybody knows how to make this code working.I dont need to load it in to pdf because of some reasons.Can anybody help me?
You still try to get url to resource that is supposed to be in your application bundle, not on remote server. Correct method to create url will be CFURLCreateWithString:
Keep in mind that it may be better to download your pdf and cache it locally before display – that approach will also give you more flexibility in error handling and probable authentication challenges for your url