- Posts: 5
- Thank you received: 0
Microsoft Windows Phone 8.1 support ends (13 Jul 2017)
Microsoft has ended support for Windows Phone 8.1
Questions about iOS development and PDF
EXC_BAD_ACCESS
IP: 192.168.0.71
12 years 1 month ago #6839
by ctdonath
EXC_BAD_ACCESS was created by ctdonath
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:
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.
Relevant code fragment:
Code:
- (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.
IP: 192.168.0.71
12 years 1 month ago #6842
by radaee
Replied by radaee on topic EXC_BAD_ACCESS
you shall keep NSData *data object till Document closeed();
IP: 192.168.0.71
12 years 1 month ago #6858
by ctdonath
Replied by ctdonath on topic EXC_BAD_ACCESS
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.
IP: 192.168.0.71
12 years 1 month ago #6859
by ctdonath
Replied by ctdonath on topic EXC_BAD_ACCESS
Is
ftp://mail.tprd.info/help_iOS_1.7.pdf
correct to follow?
IP: 192.168.0.71
12 years 1 month ago - 12 years 1 month ago #6860
by ctdonath
Replied by ctdonath on topic EXC_BAD_ACCESS
Same problem with
Data is fine:
help.pdf exists at the indicated location.
Execution does not get past Document_open, suffering EXC_BAD_ACCESS.
Code:
- (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);
Code:
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
Execution does not get past Document_open, suffering EXC_BAD_ACCESS.
Last edit: 12 years 1 month ago by akrpandey4.
IP: 192.168.0.71
12 years 1 month ago - 12 years 1 month ago #6861
by radaee
Replied by radaee on topic EXC_BAD_ACCESS
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.
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.
Last edit: 12 years 1 month ago by .
Time to create page: 0.498 seconds