gpambrozio / BlockAlertsAnd-ActionSheets

Beautifully done UIAlertView and UIActionSheet replacements inspired by TweetBot
http://codecropper.com/2012/01/replicating-tweetbots-alerts-and-action-sheets/
MIT License
1.41k stars 268 forks source link

libPods.a, +[BlockAlertView initialize] and logic tests #46

Closed boecko closed 11 years ago

boecko commented 11 years ago

My unit-test gets a __HALT signal, because of the UIFont-Loading in +[BlockAlertView initialize]. NOTE: I'm not using any UIKIT-Classes in my unit-tests. This happens because i'm linking with libPods.a.

My ugly workarround is:

+ (void)initialize
{ 
....
        BOOL senTestingKit = NO;
        NSArray *callStack = [NSThread callStackSymbols];
        for (NSString *call in callStack) {
            NSRange range = [call rangeOfString:@"SenTestingKit"];
            if(range.location != NSNotFound) {
                senTestingKit = YES;
                break;
            }
        }
        if(!senTestingKit) {
            titleFont = [kAlertViewTitleFont retain];
            messageFont = [kAlertViewMessageFont retain];
            buttonFont = [kAlertViewButtonFont retain];
        }
...
boecko commented 11 years ago

My bad ... should have made a

target :test, :exclusive => true do
    ... pods required for test ...
end

entry, without 'BlockAlertsAnd-ActionSheets'.

Anyway .. this entry is good for documention purposes, if someone has the same problem ;)