EXC_BAD_ACCESS - RadaeePDF.com
Signin/Signup with: 
Welcome, Guest
Username: Password: Remember me
13 Jul 2017
Microsoft has ended support for Windows Phone 8.1
Read More...
Questions about iOS development and PDF
  • Page:
  • 1
  • 2

TOPIC: EXC_BAD_ACCESS

EXC_BAD_ACCESS 4 years 4 months ago #6839

  • ctdonath
  • ctdonath's Avatar Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 5
  • Thank you received: 0
Try as I can, and following directions in ftp://mail.tprd.info/help_iOS_1.7.pdf , PDFViewer keeps crashing on Document_openMem (and also on Document_open).

Relevant code fragment:
- (int)PDFOpenURL:(NSURL *)url withPassword:(NSString *)pwd
{
    [self PDFClose];
    PDF_ERR err = 0;
    const char *password = [pwd UTF8String];
    NSData *data = [[NSData alloc] initWithContentsOfURL:url];
    void *rawData = (void *)(data.bytes);
    int size = data.length;
    m_doc = Document_openMem(rawData, size, password, &err);
//...

All the data looks normal & correct.
Tried lots of variations (not that there’s much to change, it’s a pretty straightforward call).
It just keeps crashing on that call with EXC_BAD_ACCESS.

Thoughts? probably something petty, but I'm not seeing it and can't look past the call as it's in the PDFViewer library.

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

EXC_BAD_ACCESS 4 years 4 months ago #6842

  • radaee
  • radaee's Avatar
  • Offline
  • Moderator
  • Moderator
  • Posts: 847
  • Karma: 43
  • Thank you received: 12
you shall keep NSData *data object till Document closeed();

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

EXC_BAD_ACCESS 4 years 4 months ago #6858

  • ctdonath
  • ctdonath's Avatar Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 5
  • Thank you received: 0
I've done several versions which do keep NSData *data intact until calling Document_closed. Same problem. The EXC_BAD_ACCESS occurs when calling Document_openMem, not after.

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

EXC_BAD_ACCESS 4 years 4 months ago #6859

  • ctdonath
  • ctdonath's Avatar Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 5
  • Thank you received: 0

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

EXC_BAD_ACCESS 4 years 4 months ago #6860

  • ctdonath
  • ctdonath's Avatar Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 5
  • Thank you received: 0
Same problem with
- (int)PDFOpen:(NSString *)path withPassword:(NSString *)pwd
{
[self PDFClose];
const char *cpath = [path UTF8String];
PDF_ERR err = 0;
const char *password = [pwd UTF8String];
m_doc = Document_open(cpath, password, &err);
Data is fine:
self	RDPDFViewController *	0xdebfd90	0x0debfd90
pwd	NSString *	nil	0x00000000
path	__NSCFString *	@"/Users/cd/Library/Application Support/iPhone Simulator/7.1/Applications/C64B6BF1-5C65-4C85-9AF2-6AEA295BC409/AppName.app/help.pdf"	0x0dee0ce0
cpath	const char *	"/Users/cd/Library/Application Support/iPhone Simulator/7.1/Applications/C64B6BF1-5C65-4C85-9AF2-6AEA295BC409/AppName.app/help.pdf"	0x0dee0ce9
err	PDF_ERR	err_ok	err_ok
password	const char *	NULL	0x00000000
m_doc	PDF_DOC	0x0	0x00000000
help.pdf exists at the indicated location.
Execution does not get past Document_open, suffering EXC_BAD_ACCESS.

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

Last edit: by akrpandey4.

EXC_BAD_ACCESS 4 years 4 months ago #6861

  • radaee
  • radaee's Avatar
  • Offline
  • Moderator
  • Moderator
  • Posts: 847
  • Karma: 43
  • Thank you received: 12
some info:
for PDFView class, vOpen need PDFDoc object, not PDF_DOC handle.
like:
PDFDoc doc = [[PDFDoc alloc] init];
[doc open:path:pswd];
PDFView view = [[PDFView alloc] initWithFrame:rect];
[view vOpen:doc:...];
//....
[view vClose];
[doc close];

PDFDoc need PDFObjc.h and PDFObjc.m in your project.

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

Last edit: by .
  • Page:
  • 1
  • 2
Powered by Kunena Forum