Problems with Universal Build...

  • Hi,

    I have a Universal build for my little app. It works fine on my
    intel box but....

    Running on my wife's PPC is turning out to be a disaster.

    When running on the PPC box ( Quicksilver 2002 latest version of tiger
    with all the patches).

    1) NSLog messages are not appearing in system.log

    2) NSTemporaryDirectory() returns a / as the last character on the Intel
        side but not on the PPC box.

    3) the PDFDocument method writeToFile works fine on the Intel side
        but goes off to la la land on the PPC box ie it never returns and
        does not write the file. The app is still functional... It took
        a while to figure this out since NSLog does not appear to be
    working.

        I run a NSRunAlertPanel just before the writeToFile call and
    immediately
        after the writeToFile returns. The first alert appears but the
    second
        one does not.?.?

    Doh,

    Any suggestions?

    Jerry
  • On 24 Dec 2007, at 00:39, Jerry LeVan wrote:

    > Hi,
    >
    > I have a Universal build for my little app. It works fine on my
    > intel box but....
    >
    > Running on my wife's PPC is turning out to be a disaster.
    >
    > When running on the PPC box ( Quicksilver 2002 latest version of tiger
    > with all the patches).
    >
    > 1) NSLog messages are not appearing in system.log

    I believe they actually go in console.log
    >
    >
    > 2) NSTemporaryDirectory() returns a / as the last character on the
    > Intel
    > side but not on the PPC box.

    Why is this a problem? All the NSString methods for manipulating paths
    are perfectly happy with either scheme.
    >
    >
    > 3) the PDFDocument method writeToFile works fine on the Intel side
    > but goes off to la la land on the PPC box ie it never returns and
    > does not write the file. The app is still functional... It took
    > a while to figure this out since NSLog does not appear to be
    > working.
    >
    > I run a NSRunAlertPanel just before the writeToFile call and
    > immediately
    > after the writeToFile returns. The first alert appears but the
    > second
    > one does not.?.?
    >
    > Doh,
    >
    > Any suggestions?
    >
    > Jerry
  • On 2007 Dec, 23, at 16:39, Jerry LeVan wrote:

    > 1) NSLog messages are not appearing in system.log

    In Tiger, my NSLog messages show in console.log, not system.log.

    > 2) NSTemporaryDirectory() returns a / as the last character on the
    > Intel
    > side but not on the PPC box.

    Interesting.  If true, now you know why Apple recommends using the
    methods listed in NSString under "Working with Paths", such as -
    deleteLastPathComponent, etc.  They are supposedly tolerant of stuff
    like that.
  • On Dec 23, 2007, at 7:55 PM, Mike Abdullah wrote:

    >
    > On 24 Dec 2007, at 00:39, Jerry LeVan wrote:
    >
    >> Hi,
    >>
    >> I have a Universal build for my little app. It works fine on my
    >> intel box but....
    >>
    >> Running on my wife's PPC is turning out to be a disaster.
    >>
    >> When running on the PPC box ( Quicksilver 2002 latest version of
    >> tiger
    >> with all the patches).
    >>
    >> 1) NSLog messages are not appearing in system.log
    >
    > I believe they actually go in console.log
    >>
    >>
    >> 2) NSTemporaryDirectory() returns a / as the last character on the
    >> Intel
    >> side but not on the PPC box.
    >
    > Why is this a problem? All the NSString methods for manipulating
    > paths are perfectly happy with either scheme.
    >>
    >>
    >> 3) the PDFDocument method writeToFile works fine on the Intel side
    >> but goes off to la la land on the PPC box ie it never returns and
    >> does not write the file. The app is still functional... It took
    >> a while to figure this out since NSLog does not appear to be
    >> working.
    >>
    >> I run a NSRunAlertPanel just before the writeToFile call and
    >> immediately
    >> after the writeToFile returns. The first alert appears but the
    >> second
    >> one does not.?.?
    >>
    >> Doh,
    >>
    >> Any suggestions?
    >>
    >> Jerry
    >>

    You are right about the first two questions, checking the console I
    find that the
    following error appears immediately after the attempt to write the pdf

    2007-12-23 20:12:35.052 ImageBrowser[2490] *** -[NSCFNumber isLocked]:
    selector not recognized [self = 0x3efd00]
    2007-12-23 20:12:35.053 ImageBrowser[2490] *** -[NSCFNumber isLocked]:
    selector not recognized [self = 0x3efd00]

    Since it works fine on Intel I am suspecting an error somewhere in the
    ppc libraries...

    Jerry

    [ a little later...]

    It appears that the code that works on the intel box to create a
    multipage pdf
    gets wonky on the ppc.

    Here is the loop that creates the multipage pdf. ( I earlier  created
    an empty pdf )
    If I test for i==0 instead of i==1 below the write works when I test
    for 1
    above two messages appear and control does not return from the
    writeToFile.

    (But the app is still responsive).
    ----------------------------
      int fcnt = [fileNameList count];

    int i;
    for(i=0;i< cnt;i++) {
    theImage =[ [NSImage alloc] initWithContentsOfFile: [fileNameList
    objectAtIndex:i]];
    NSImageView    *pdfView = [[NSImageView alloc]
          initWithFrame:NSMakeRect(0,0,
          [theImage size].width,
          [theImage size].height)];

    [pdfView setImage:theImage];
    NSData    *pdfData;
    pdfData = [pdfView dataWithPDFInsideRect:[pdfView bounds]];
    PDFDocument * tmpPage = [[PDFDocument alloc] initWithData: pdfData];
    [myBook insertPage:[ tmpPage pageAtIndex: 0] atIndex: i];
    if( i==1) [myBook writeToFile:@"/Users/marijo/Desktop/bar.pdf"];
    <---  NEVER RETURNS IF I=1
    [pdfView release];
    [tmpPage release];
    [theImage release];
    [filesLeft setIntValue: --fcnt];
    [filesLeft displayIfNeeded];
      }
    ------------------------------------
  • On Dec 23, 2007, at 8:13 PM, Jerry LeVan wrote:

    > You are right about the first two questions, checking the console I
    > find that the
    > following error appears immediately after the attempt to write the pdf
    >
    >
    > 2007-12-23 20:12:35.052 ImageBrowser[2490] *** -[NSCFNumber
    > isLocked]: selector not recognized [self = 0x3efd00]
    > 2007-12-23 20:12:35.053 ImageBrowser[2490] *** -[NSCFNumber
    > isLocked]: selector not recognized [self = 0x3efd00]
    >
    > Since it works fine on Intel I am suspecting an error somewhere in
    > the ppc libraries...

    Why would you say that?  If you look at what's given in the console,
    you'll see that an instance of NSNumber/CFNumber is being sent the
    isLocked message.  Looking up isLocked in the docs reveals that it's a
    message that can be sent to instances of PDFDocument.

    Thus, I believe your app is trashing memory since you're working with
    the PDF API and somehow what used to be a PDFDocument instance is now
    something else.

    Run your app with the various memory-debugging stuff (e.g. zombies,
    malloc scribble, etc.)

    ___________________________________________________________
    Ricky A. Sharp        mailto:<rsharp...>
    Instant Interactive(tm)  http://www.instantinteractive.com
  • On Dec 23, 2007, at 9:38 PM, Ricky Sharp wrote:

    >
    > On Dec 23, 2007, at 8:13 PM, Jerry LeVan wrote:
    >
    >> You are right about the first two questions, checking the console I
    >> find that the
    >> following error appears immediately after the attempt to write the
    >> pdf
    >>
    >>
    >> 2007-12-23 20:12:35.052 ImageBrowser[2490] *** -[NSCFNumber
    >> isLocked]: selector not recognized [self = 0x3efd00]
    >> 2007-12-23 20:12:35.053 ImageBrowser[2490] *** -[NSCFNumber
    >> isLocked]: selector not recognized [self = 0x3efd00]
    >>
    >> Since it works fine on Intel I am suspecting an error somewhere in
    >> the ppc libraries...
    >
    >
    > Why would you say that?  If you look at what's given in the console,
    > you'll see that an instance of NSNumber/CFNumber is being sent the
    > isLocked message.  Looking up isLocked in the docs reveals that it's
    > a message that can be sent to instances of PDFDocument.
    >
    > Thus, I believe your app is trashing memory since you're working
    > with the PDF API and somehow what used to be a PDFDocument instance
    > is now something else.
    >
    > Run your app with the various memory-debugging stuff (e.g. zombies,
    > malloc scribble, etc.)

    It appears that on the ppc box that when building a pdf doc by adding
    pages, the
    pages need to be "kept around".

    The following snippet seems to have fixed the problem... I replaced
    tmpPage
    with an array tmpPage and all of the badness seems to have vanished.
    Tain't
    clear to me why the non-array approach did not cause a problem on the
    Intel side...

    Jerry

    NSImageView * pdfView;
    NSData    *pdfData;
    //PDFDocument * tmpPage;
    NSMutableArray * tmpPage = [NSMutableArray array];
    int i;
    for(i=0;i< cnt;i++) {
    theImage =[ [NSImage alloc] initWithContentsOfFile: [fileNameList
    objectAtIndex:i]];
    pdfView = [[NSImageView alloc]
      initWithFrame:NSMakeRect(0,0,
      [theImage size].width,
      [theImage size].height)];

    [pdfView setImage:theImage];
    pdfData = [pdfView dataWithPDFInsideRect:[pdfView bounds]];
    //tmpPage = [[PDFDocument alloc] initWithData: pdfData];
    //[myBook insertPage:[ tmpPage pageAtIndex: 0] atIndex: i];
    [tmpPage addObject:  [[[PDFDocument alloc] initWithData: pdfData]
    autorelease]];
    [myBook insertPage:[ [tmpPage objectAtIndex:i] pageAtIndex:0]
    atIndex:i];
    //if( i==1) [myBook writeToFile:@"/Users/marijo/Desktop/bar.pdf"];
    [pdfView release];
    //[tmpPage release];
    [theImage release];
    [filesLeft setIntValue: --fcnt];
    [filesLeft displayIfNeeded];
      }
previous month december 2007 next month
MTWTFSS
          1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
31            
Go to today