Created
February 23, 2012 16:02
-
-
Save martijnthe/1893437 to your computer and use it in GitHub Desktop.
Workaround-plugin for Xcode 4.4 to fix a crash when running unit tests
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>CFBundleDevelopmentRegion</key> | |
<string>English</string> | |
<key>CFBundleExecutable</key> | |
<string>$(EXECUTABLE_NAME)</string> | |
<key>CFBundleIdentifier</key> | |
<string>com.martijnthe.${PRODUCT_NAME:rfc1034identifier}.xcodeplugin</string> | |
<key>CFBundleInfoDictionaryVersion</key> | |
<string>6.0</string> | |
<key>CFBundleName</key> | |
<string>$(PRODUCT_NAME)</string> | |
<key>CFBundlePackageType</key> | |
<string>BNDL</string> | |
<key>CFBundleShortVersionString</key> | |
<string>4.0.0</string> | |
<key>CFBundleSignature</key> | |
<string>????</string> | |
<key>CFBundleVersion</key> | |
<string>1</string> | |
<key>CSResourcesFileMapped</key> | |
<string>yes</string> | |
<key>NSHumanReadableCopyright</key> | |
<string>Copyright © 2012 martijnthe.nl. All rights reserved.</string> | |
<key>CFBundleGetInfoString</key> | |
<string>v0.1 Copyright © 2012 martijnthe.nl. All rights reserved.</string> | |
<key>LoadAtLaunch</key> | |
<string>YES</string> | |
<key>XCGCReady</key> | |
<string>YES</string> | |
<key>XCPluginHasUI</key> | |
<string>NO</string> | |
<key>NSPrincipalClass</key> | |
<string>XcodeFixups</string> | |
<key>XC4Compatible</key> | |
<true/> | |
</dict> | |
</plist> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// Xcode4_4Fixups.m | |
// Xcode4_4Fixups | |
// | |
// Created by Martijn Thé on 2/23/12. | |
// Copyright (c) 2012 martijnthe.nl All rights reserved. | |
// | |
#import <Cocoa/Cocoa.h> | |
#import <objc/objc-runtime.h> | |
#import "IDETest.h" | |
NSComparisonResult localizedStandardCompare(IDETest* _self, SEL cmd, IDETest* other); | |
NSComparisonResult localizedStandardCompare(IDETest* _self, SEL cmd, IDETest* other) { | |
return [[_self identifier] localizedStandardCompare:[other identifier]]; | |
} | |
@interface XcodeFixups : NSObject @end | |
@implementation XcodeFixups | |
+ (void)initialize { | |
NSLog(@"Xcode4_4Fixups_init..."); | |
NSLog(@"Fixing -[IDETest localizedStandardCompare:] crashes..."); | |
Class IDETestClass = NSClassFromString(@"IDETest"); | |
if (IDETestClass) { | |
BOOL didAdd = class_addMethod(IDETestClass, @selector(localizedStandardCompare:), (IMP)localizedStandardCompare, "i@:@"); | |
if (didAdd) { | |
NSLog(@"Added -[IDETest localizedStandardCompare:] method implementation."); | |
} else { | |
NSLog(@"Failed."); | |
} | |
} else { | |
NSLog(@"Class IDETest not (yet) loaded."); | |
} | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks Martijn. Yeah, guess it can't hurt to have the same plugin out there twice :)