Professional Web Applications Themes

CFBundleGetBundleWithIdentifier - Mac Programming

An application of mine works without any problem at all on all setups it's been tested on (hundreds), but for one user it sems like the call to CFBundleRef bundle = CFBundleGetBundleWithIdentifier( ... ) .... returns NULL. It's from the same bundle the call is made, in other words it's retrieving the path to itself (well the actual path is found by then calling CFBundleCopyBundleURL and then CFURLGetFileSystemRepresentation) so the bundle is clearly there on his computer. But still it's not found. How come it doesn't work on his system? An old QuickTime version? However, I think it's been available ...

  1. #1

    Default CFBundleGetBundleWithIdentifier

    An application of mine works without any problem at all on all setups it's been
    tested on (hundreds), but for one user it sems like the call to

    CFBundleRef bundle = CFBundleGetBundleWithIdentifier( ... )

    .... returns NULL. It's from the same bundle the call is made, in other words
    it's retrieving the path to itself (well the actual path is found by then calling
    CFBundleCopyBundleURL and then CFURLGetFileSystemRepresentation)
    so the bundle is clearly there on his computer. But still it's not found.

    How come it doesn't work on his system? An old QuickTime version?
    However, I think it's been available since version 3 or so, long ago.
    Any thoughts?

    M


    Mike Guest

  2. #2

    Default Re: CFBundleGetBundleWithIdentifier

    In article <vO6oc.58827$telia.net>,
    "Mike H" <se> wrote:
     

    The most likely answer is that your Info.plist is wrong, the most likely
    culprits being a missing or incorrect bundle ID or a missing or incorrect bundle
    executable name. You should tun plistchecker (IIRC) over your plist.

    meeroh

    --
    If this message helped you, consider buying an item
    from my wish list: <http://web.meeroh.org/wishlist>

    Miro Guest

  3. #3

    Default Re: CFBundleGetBundleWithIdentifier

    > > An application of mine works without any problem at all on all setups it's 
    >
    > The most likely answer is that your Info.plist is wrong, the most likely
    > culprits being a missing or incorrect bundle ID or a missing or incorrect bundle
    > executable name. You should tun plistchecker (IIRC) over your plist.
    >[/ref]

    One thing: The call is done in the actual constructor of the component.
    Am I allowed to do that? The object is actually not created yet. Reading the
    docs, they say that the above function can only be called if the object has already
    been allocated. However what's strange is that it works in most cases.

    What's the alternative to finding the disk path to the application? It has to be done
    in the constructor and the host application which allocates the component measures
    the time it takes to allocate it and if it takes too long time then it gives up regarding
    it as an error.

    I've checked the plist manually and I cannot see any problem with it, but thanks
    for the tip using plistchecker. Can it be damaged if it's distributed as a
    disk image file? Don't think so...



    Mike Guest

  4. #4

    Default Re: CFBundleGetBundleWithIdentifier

    In article <5N7oc.92249$telia.net>,
    "Mike H" <se> wrote:
     

    I have no idea what you mean here, as I am not sure what you mean by constructor
    (a C++ concept unlikely to mean something in the context of shared libraries and
    perhaps component manager, but you don't make that explicit), nor which docs you
    are referring to.
     

    Why are you asking that? Your code is currently not looking for the path to the
    application, but the path to a bundle loaded by that application.

    meeroh

    --
    If this message helped you, consider buying an item
    from my wish list: <http://web.meeroh.org/wishlist>

    Miro Guest

  5. #5

    Default Re: CFBundleGetBundleWithIdentifier



    Ok. Never mind then.


    Mike Guest

  6. #6

    Default Re: CFBundleGetBundleWithIdentifier

    In article <4dloc.58890$telia.net>,
    "Mike H" <se> wrote:
     
    >
    > Ok. Never mind then.[/ref]

    That response really makes it hard to help you.

    meeroh

    --
    If this message helped you, consider buying an item
    from my wish list: <http://web.meeroh.org/wishlist>

    Miro Guest

  7. #7

    Default Re: CFBundleGetBundleWithIdentifier

    > > 
    >
    > That response really makes it hard to help you.
    >[/ref]

    Oh sorry, I never meant to be rude, but it's done in C++ and
    you need to know what a constructor is to solve the problem.
    But never mind, I think I've solved it. I'm not using that function,
    but have implemented my own instead.

    Thanks anyway.


    Mike Guest

  8. #8

    Default Re: CFBundleGetBundleWithIdentifier

    In article <JlJoc.92379$telia.net>,
    "Mike H" <se> wrote:
     
    > >
    > > That response really makes it hard to help you.
    > >[/ref]
    >
    > Oh sorry, I never meant to be rude, but it's done in C++ and
    > you need to know what a constructor is to solve the problem.
    > But never mind, I think I've solved it. I'm not using that function,
    > but have implemented my own instead.[/ref]

    I know what a constructor is. You haven't explained why you believe it should
    make a difference this code is called from a constructor. Constructors are not
    magic, so it should not make any difference whether you call CFBundle from a
    constructor or not.

    meeroh

    --
    If this message helped you, consider buying an item
    from my wish list: <http://web.meeroh.org/wishlist>

    Miro Guest

  9. #9

    Default Re: CFBundleGetBundleWithIdentifier

    > > > > 
    > >
    > > Oh sorry, I never meant to be rude, but it's done in C++ and
    > > you need to know what a constructor is to solve the problem.
    > > But never mind, I think I've solved it. I'm not using that function,
    > > but have implemented my own instead.[/ref]
    >
    > I know what a constructor is. You haven't explained why you believe it should
    > make a difference this code is called from a constructor. Constructors are not
    > magic, so it should not make any difference whether you call CFBundle from a
    > constructor or not.
    >[/ref]

    Everything's explained here:
    http://developer.apple.com/doentation/CoreFoundation/Reference/CFBundleRef/Reference/function_group_1.html#//apple_ref/c/func/CFB
    undleGetBundleWithIdentifier

    (the line is long and will break, so you have to paste it back again in your browser)

    And the discussion says:
     

    And I'm calling it in the bundle object's constructor, which means that it's *being* created, but hasn't
    been created yet.

    M


    Mike Guest

  10. #10

    Default Re: CFBundleGetBundleWithIdentifier


    http://developer.apple.com/doentation/CoreFoundation/Reference/CFBundleRef/Reference/function_group_1.html#//apple_ref/c/func/CFB 
    >
    > And I'm calling it in the bundle object's constructor, which means that it's *being* created, but hasn't
    > been created yet.
    >
    > M
    >[/ref]

    Or when they say "the bundle object must have already been created", do they mean that it has
    to exist on disk, in the system?

    M


    Mike Guest

  11. #11

    Default Re: CFBundleGetBundleWithIdentifier

    In article <b5Ooc.92406$telia.net>,
    "Mike H" <se> wrote:
     

    It means it already has to have been created for some reason, like
    loaded into your process. If you are a carbon app you can use
    CFBundleGetBundleWithIdentifier to get "com.apple.Carbon", but the
    bundle for Safari would not have been magically created, so asking for
    "com.apple.Safari" in the same way will fail.

    Jim


    Jim Guest

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

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 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139