About _LSCopyAllApplicationURLs api

Discussion in 'Mac Programming' started by Simran123, Jun 6, 2016.

  1. Simran123 macrumors newbie

    Joined:
    Jun 21, 2012
    #1
    Hi,

    I have used "_LSCopyAllApplicationURLs" to get all Applications present in Mac OS.

    My sample enumerates application after particular period. If machine is ON for 1/2 days, it gets following crash on Mac OS 10.8.3.

    --------------------------------------------------------------

    Exception Type: EXC_BAD_ACCESS (SIGBUS)

    Exception Codes: KERN_PROTECTION_FAILURE at 0x0000000000000000
    .
    .
    .
    ........
    CFDictionaryGetValue + 18

    1 com.apple.LaunchServices 0x96575747 _LSAppInfoCheckVersion(__CFDictionary const*, __CFString const*, unsigned long long) + 30

    2 com.apple.LaunchServices 0x96576c76 _LSRegisterBundleNode(LSContext*, unsigned long, FSNode*, FSNode*, unsigned long, unsigned long*) + 2164

    3 com.apple.LaunchServices 0x9650d559 _LSFindOrRegisterBundleNode + 935

    4 com.apple.LaunchServices 0x965758d6 _LSRegisterNode + 96

    5 com.apple.LaunchServices 0x96515dcc _LSBundleCopyOrCheckNode + 1252

    6 com.apple.LaunchServices 0x96562e5f _LSCopyAllApplicationURLs + 2
    ---------------------------------------------------------------

    - If anyone gone through same issue, please guide me.
    - Is it safe to use "_LSCopyAllApplicationURLs” in project"?


    Thanks,
    Simran
     
  2. Madd the Sane macrumors 6502

    Madd the Sane

    Joined:
    Nov 8, 2010
    Location:
    Utah
    #2
    LSCopyAllApplicationURLs is a private function; this means that Apple doesn't want you to use it, as it might be removed, is undocumented, and may change between OS revisions.

    The best replacement I can think of is to use NSBundle's allBundles class method, then filter out all bundles that don't end with .app.
     

Share This Page