Signin/Signup with: 
Welcome, Guest
Username: Password: Remember me
Questions about iOS development and PDF
  • Page:
  • 1

TOPIC:

Crash HTTPStream 9 years 8 months ago #6890

  • mobiledeveloperinit
  • mobiledeveloperinit's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 3
  • Thank you received: 0
Hi,
I'm trying to implement a HTTPStream in my iOS app. I added the PDFHTTPStream Class from the Demo. I also added the -(int)PDFOpenStream:(id<PDFStream>)stream :(NSString *)password method exactly like in the RDPDFViewController class. I call this method like it is done in the Class RDFileTableController in -(void)selectRightAction:
if( m_pdf == nil )
    {
        m_pdf = [[RDPDFViewController alloc] initWithNibName:@"RDPDFViewController" bundle:nil];
    }
    NSString *testfile = [[NSTemporaryDirectory() stringByAppendingString:@""] stringByAppendingString:@"test.pdf"];
    if([[NSFileManager defaultManager] fileExistsAtPath:testfile] == NO){
        NSLog(@"file not exist,create it...");
        [[NSFileManager defaultManager] createFileAtPath:testfile contents:nil attributes:nil];
    }else {
        NSLog(@"file exist!!!");
    }

    //Open PDF HTTPStream demo
    //@testUrlPath: the http pdf path you requested,this url needs support [NSURLRequest forHTTPHeaderField:@"Range"] method
    //@testfile : You need set a temp path in sandbox to save the request file
     httpStream = [[PDFHttpStream alloc] init];
     [httpStream open:testUrlPath :testfile];
     [m_pdf PDFOpenStream:httpStream :@""];
    
    UINavigationController *nav = self.navigationController;
    m_pdf.hidesBottomBarWhenPushed = YES;
    [nav pushViewController:m_pdf animated:YES];

The app always crashes in [PDFDoc page:] with [__NSSetM seek:]: unrecognized selector sent to instance. whe Document_getPage is called.

#0 0x396821f0 in __pthread_kill ()
#1 0x396ea7b6 in pthread_kill ()
#2 0x39632ff8 in abort ()
#3 0x38a8198e in abort_message ()
#4 0x38a9a6e6 in default_terminate_handler() ()
#5 0x390cdf7c in _objc_terminate() ()
#6 0x38a981b2 in std::__terminate(void (*)()) ()
#7 0x38a97a08 in __cxa_throw ()
#8 0x390cddba in objc_exception_throw ()
#9 0x2e93c836 in -[NSObject(NSObject) doesNotRecognizeSelector:] ()
#10 0x2e93b12e in ___forwarding___ ()
#11 0x2e88a0d8 in _CF_forwarding_prep_0 ()
#12 0x0082a02a in CRDStreamIOS::SetPos(CRDStream::STR_SEEK, long long) ()
#13 0x0085ae70 in CPDFXRefTable::get_entity(CPDFObj&, PDF_REF const&) ()
#14 0x0085c626 in CPDFXRefTable::get_entity(CPDFObj&, CPDFObj const*) ()
#15 0x00832610 in CPDFPageTree::pro_load_children(CRDLocker&) ()
#16 0x008332b8 in CPDFPageTree::pro_get_page(int&, CRDLocker&) ()
#17 0x007dc0b0 in CPDFDoc::DocGetPage(int) ()
#18 0x00824b7a in Document_getPage ()
#19 0x0006cc08 in -[PDFDoc page:] at /Users/admin/.../View/PDFLib/PDFObjc.m:1068
#20 0x0005cad6 in -[PDFVCache Render] at /Users/admin/.../View/PDFView/PDFVPage.m:79
#21 0x00066958 in thread_route at /Users/admin/.../View/PDFView/PDFVThread.m:26
#22 0x396e9958 in _pthread_body ()
#23 0x396e98ca in _pthread_start ()
#24 0x396e7ae8 in thread_start ()

Can anyone help me?

Please Log in or Create an account to join the conversation.

Crash HTTPStream 9 years 8 months ago #6905

  • radaee
  • radaee's Avatar
  • Offline
  • Moderator
  • Moderator
  • Posts: 1123
  • Thank you received: 73
make sure the http server support 'bytes-range' header.

Please Log in or Create an account to join the conversation.

Crash HTTPStream 9 years 8 months ago #6908

  • mobiledeveloperinit
  • mobiledeveloperinit's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 3
  • Thank you received: 0
Yes, it does.
It also crashes with the link in the demo.

Please Log in or Create an account to join the conversation.

Crash HTTPStream 9 years 8 months ago #6909

  • mobiledeveloperinit
  • mobiledeveloperinit's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 3
  • Thank you received: 0
Now it works. I deleted the Viewer from my App and did everything again (of corse in the same way I did it before :-) and now it works. Don't know what the problem was.

Please Log in or Create an account to join the conversation.

  • Page:
  • 1
Powered by Kunena Forum