Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Could it be that you're calling <code>CFBundleCopyInfoDictionaryForURL</code> on the code signed helper tool?</p> <p>If so, it appears as though this function seems to break the code signing validity. (Presumably because <code>CFBundle</code> modifies the Info.plist data in memory, but this is just my guess.)</p> <p>The solution is to use <code>SecCodeCopySigningInformation</code> to read the helper tool's version info:</p> <pre class="lang-c prettyprint-override"><code>-(NSString *) bundleVersionForCodeSignedItemAtURL:(NSURL *)url { OSStatus status; // Sanity check -- nothing begets nothing if (!url) { return nil; } // Get the binary's static code SecStaticCodeRef codeRef; status = SecStaticCodeCreateWithPath((CFURLRef)url, kSecCSDefaultFlags, &amp;codeRef); if (status != noErr) { NSLog(@"SecStatucCodeCreateWithPath() error for %@: %d", url, status); return nil; } // Get the code signature info CFDictionaryRef codeInfo; status = SecCodeCopySigningInformation(codeRef, kSecCSDefaultFlags, &amp;codeInfo); if (status != noErr) { NSLog(@"SecCodeCopySigningInformation() error for %@: %d", url, status); CFRelease(codeRef); return nil; } // The code signature info gives us the Info.plist that was signed, and // from there we can retrieve the version NSDictionary *bundleInfo = (NSDictionary *) CFDictionaryGetValue(codeInfo, kSecCodeInfoPList); NSString *version = [bundleInfo objectForKey:@"CFBundleVersion"]; // We have ownership of the code signature info, so we must release it. // Before we do that, we need to hold onto the version otherwise we go // crashing and burning. [[version retain] autorelease]; CFRelease(codeInfo); CFRelease(codeRef); return version; } </code></pre> <p>To give credit where it's due: the vital piece of information regarding <code>CFBundleCopyInfoDictionaryForURL</code> came from <a href="https://github.com/nevir/SMJobKit" rel="nofollow">Ian MacLeod's <code>SMJobKit</code></a>.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload