On Feb 17, 2008, at 1:07 PM, Kevin Ross wrote:
This snippet of code works fine on Leopard but not on Tiger.....

- (void)awakeFromNib  {

NSString *outPath = [@"~/Desktop/debug.pdf" stringByExpandingTildeInPath];
        [self writeDebugPDFDocument:[self pdfDocument] toPath:outPath];
        

[self setPageCount:[pdfDocument pageCount]]; <---- pageCount = 1 (like it should) [pdfView setDocument:[self pdfDocument]]; <------- Throws exception here.
        [self skipToPage:[NSNumber numberWithInt:1]];
        [pdfView layoutDocumentView];
}

Debugger log output:    
2008-02-17 12:26:51.163 Imposer[455] indexForPage: page not found
2008-02-17 12:26:51.163 Imposer[455] *** Uncaught exception: <NSGenericException> indexForPage: page not found

Stack trace:
#0      0x92c0107c in _NSRaiseError
#1      0x92c00db8 in +[NSException raise:format:]
#2      0x9648b894 in -[PDFDocument indexForPage:]
#3      0x9648aaec in -[PDFView viewSizeForPage:]
#4      0x9648a1b0 in -[PDFView resizeDisplayView:]
#5      0x964899e0 in -[PDFView setDocument:]
#6 0x000d512c in -[KRImposerDocument awakeFromNib] at KRImposerDocument.m:78

It's hard to answer you without knowing more about your class/app.

I take it the code snippet is from KRImposerDocument? This is a PDFView subclass?

What does skipToPage: do? Specifically, is it 1-based or zero based (because PDFKit is zero-based).


I'm sure it's something I'm doing (possibly some autorelease craziness?) since this snippet works fine when the document is opened via the "Open" menu, and only happens when a new document has been created programmatically from the originally opened one.

That bit puzzles me. How are you creating the document programatically? There were small odd differences between Leopard and Tiger here....

John Calhoun—

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to