Skip to content

Instantly share code, notes, and snippets.

View depth42's full-sized avatar

Frank Illenberger depth42

  • ProjectWizards
  • Frankfurt, Germany
View GitHub Profile
@depth42
depth42 / gist:6886194
Last active December 25, 2015 00:09
The xib compiler in Xcode 5.0.1 always sets the scaling bit of all NSViews which results in dramatically reduced performance. Until Apple fixes this severe bug, we work around this by patching NSKeyedUnarchiver to clear the bit during decoding of the compiled xib files. By the way: We filed this bug three months ago under rdar://14359398.
@interface NSKeyedUnarchiver (Xcode5Fix)
@end
@implementation NSKeyedUnarchiver (Xcode5Fix)
+ (void)load
{
[self exchangeInstanceMethod:@selector(decodeInt32ForKey:)
withMethod:@selector(xcode5Fix_decodeInt32ForKey:)];
}
@depth42
depth42 / gist:7346100
Created November 6, 2013 23:27
How to make Xcode Server send notification e-mails from a DSL dialup line.
Xcode Server notifies developers via e-mail (sadly no Jabber support yet) about the state of its integrations. In the default settings, Mavericks Server directly tries to send these messages. If your Xcode Server runs on a regular dialup DSL line, these messages will most likely be bounced as spam.
To get it to work one needs to activate the relay option in the Server.app > Mail settings with the credentials of your e-mail ISP.
But additionally I had to issue the following commands in Terminal.app to make it work:
sudo postconf -c /Library/Server/Mail/Config/postfix/ -e "smtp_sasl_security_options = noanonymous"
sudo postfix reload
sudo postsuper -r ALL
@depth42
depth42 / gist:7355346
Created November 7, 2013 14:23
Xcode Server has the problem that one can only access the build log files once the build or test process has finished. But as it can occur that tests hang, it is hard to analyze why and where the hang actually happened. This little shell script helps debugging by showing the log output of the currently running bot.
#!/bin/bash
# Shell script to be executed on a Mavericks Server runing Xcode Server using sudo
BOTRUN_DATA=/Library/Server/Xcode/Data/BotRuns
LATEST_RUN=`ls -tr $BOTRUN_DATA | grep BotRun- | tail -n1`
tail -f ${BOTRUN_DATA}/${LATEST_RUN}/output/build.log
@depth42
depth42 / gist:7356279
Created November 7, 2013 15:16
Workaround for XCTest not reporting failing NSAssertions.
#import "PWAssertionHandler.h"
#import "PWLog.h"
#import "Intercept_objc_exception_throw.h"
#import <objc/runtime.h>
#import "PWDispatch.h"
#ifndef NDEBUG
@interface NSAssertionHandler (PWExtensions)
@property (nonatomic, readonly) BOOL isPWHandler;
@depth42
depth42 / gist:7419263
Created November 11, 2013 19:51
My former Jenkins build script for performing xcode tests using xcodebuild and ocunit2junit
rm -f ${WORKSPACE}/test-reports/*.xml
rm -rf /Users/jenkins/Library/Developer/Xcode/DerivedData
rm -rf ${WORKSPACE}/Build/Products
nice -n 20 xcodebuild -workspace MyWorkspace.xcworkspace -scheme MyScheme -configuration Debug SYMROOT=${WORKSPACE}/Build/Products clean test OTHER_CFLAGS=&apos;$(inherited) -Qunused-arguments -Werror&apos; | ocunit2junit
@depth42
depth42 / gist:7419292
Created November 11, 2013 19:54
My former Jenkins build script for performing xcode tests using xctool
rm -f ${WORKSPACE}/test-report.xml
rm -rf /Users/jenkins/Library/Developer/Xcode/DerivedData
rm -rf ${WORKSPACE}/Build/Products
nice -n 20 /Users/jenkins/xctool/xctool -reporter pretty -reporter junit:${WORKSPACE}/test-report.xml -workspace MyWorkspace.xcworkspace -scheme MyScheme -configuration Debug SYMROOT=${WORKSPACE}/Build/Products test OTHER_CFLAGS='$(inherited) -Qunused-arguments -Werror'
# Note the -Qunused-arguments is needed because xcodebuild adds unused compiler arguments about which clang complains a lot. Together with -Werror this results in failed builds. So we have to silence this kind of warning.
@depth42
depth42 / Example for not breaking on certain exceptions
Last active August 9, 2016 14:14
Breaking on exceptions in Objective-C is cumbersome, because a breakpoint on objc_exception_throw cannot differentiate between an expected (caught) exception and an unexpected exception (like one from a failed assertion). To work around this, we intercept objc_exception_throw using mach_override and apply filter rules to decide whether to break …
@implementation NSManagedObjectContext (PWExtensions)
#ifndef NDEBUG
// Core Data uses exceptions to notify itself about optimistic locking failures. These exceptions are intercepted by
// Core Data and never reach the client code. Such an exception should not drop in the debugger because it is not raised
// due to a programming error.
// Since the exception is thrown inside -[NSManagedObjectContext save:], this category is a logical place to install
// the filter.
+ (void) load
{
@depth42
depth42 / MEUnarchiver.h
Last active August 29, 2015 14:17
Attempt at implementing a replacement for NSUnarchiver which is not available under iOS. This can be handy for reading legacy file-formats on iOS devices. It does not provide all features of NSUnarchiver but the basic stuff is there. Has been moved to https://github.com/depth42/MEUnarchiver
Has been moved to https://github.com/depth42/MEUnarchiver
@depth42
depth42 / gist:fbe19ed2ac953753e744
Created July 2, 2015 10:31
How to prevent Xcode from automatically restoring the last open project. This enables running multiple Xcode versions for different projects.
defaults write com.apple.dt.Xcode ApplePersistenceIgnoreState YES
@depth42
depth42 / gist:3cca45bea960f073269b
Created October 22, 2015 11:54
Configuring SMPT relay for Xcode server
sudo xcrun xcscontrol --configure-email-transport 127.0.0.1