Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8972411
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T18:12:45+00:00 2026-06-15T18:12:45+00:00

If have initialized an PDFDocument with an URL and assigned it to a PDFView:

  • 0

If have initialized an PDFDocument with an URL and assigned it to a PDFView:

view.document = [[[PDFDocument alloc] initWithURL: url] autorelease];

The URL is a file URL. I want to overwrite the URL loading with a custom NSURLProtocol to support a custom decryption system.
I want to use file URL (as opposed to loading NSData redirectly) because the PDF’s can contain links to other PDF’s and loading without a URL will not support this.

I have registered a custom URL protocol in the app delegate:

 [NSURLProtocol registerClass: [MYURLProtocol class]];

But the +canInitWithRequest: is never called. I have tried with other (custom) schema but they give the same results.

When loading a WebView from a file URL the same +canInitWithRequest: does get called.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T18:12:46+00:00Added an answer on June 15, 2026 at 6:12 pm

    the NSURLProtocol class documentation makes it sound to me like NSURLProtocol subclasses are only used when loading NSURLs via NSURLConnection (or NSURLDownload):

    An application should never need to directly instantiate an NSURLProtocol subclass. The instance of the appropriate NSURLProtocol subclass for an NSURLRequest is created by NSURLConnection when a download is started.

    So that might be the root cause of the issue you are having. Be interesting grab the file via an NSURLConnection & associated NSURLRequest and see if your NSURLProtocol subclass is called as you expect; I suspect it will be.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have vector< pair<int, int>> myVec (N); I want to have all pairs initialized
I have a Document object initialized in the init() method of the servlet and
I have a NSDate *date1 in class1 implementation file(I initialized it as Global variable).
I have initialized my form submission like following: $(document).ready(function() { $(#my_form).submit(function(e) { ... ...
I have initialized a java.util.logging.Logger bean and now want to add a Handler which
I am using jquery ui dialog. I have initialized a dialog at document.ready event.
Error % javac StringTest.java StringTest.java:4: variable errorSoon might not have been initialized errorSoon[0] =
$ javac InitInt.java InitInt.java:7: variable right might not have been initialized InitInt(){} ^ 1
I have a timer which will be initialized on viewDidLoad, and be released on
I have a class that needs to be initialized but it's namespaced like this:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.