Cocoanetics / DTFoundation

Standard toolset classes and categories
BSD 2-Clause "Simplified" License
805 stars 237 forks source link

Changed designated initializer, so it will work with iOS 8 #67

Closed MacMannes closed 10 years ago

MacMannes commented 10 years ago

In iOS 8, DTAlertView dit not work anymore.

The overridden standard init method was not called anymore, so the _actionsPerIndex remained nil and blocks were not executed anymore.

I tested this change on iOS 8 beta4, iOS 7.1 and iOS 6.

coveralls commented 10 years ago

Coverage Status

Coverage increased (+0.27%) when pulling 70366329a646a4c35f4e944148175b830c2db980 on MacMannes:develop into d5a1e72ec71e8a0e250e2f059fc82c225e1d68d3 on Cocoanetics:develop.

odrobnik commented 10 years ago

@MacMannes sorry, I didn't see your PR. @renep fixed this slightly differently and also provided a unit test: 917bc94f645332b6e4355ca294f8b20f7d2e68eb - does this find your approval?

odrobnik commented 10 years ago

Fixed by #68

MacMannes commented 10 years ago

Hi, sorry for the late reply.

I think my code is a bit more DRY, but I like the unit test.

Best,

André

odrobnik commented 10 years ago

@MacMannes Please explain "a bit more DRY"

MacMannes commented 10 years ago

Hi Oliver,

DRY means Don't Repeat Yourself and the following initialization code is used twice:

_actionsPerIndex = [[NSMutableDictionary alloc] init];
self.delegate = self;

I always try to avoid duplicate lines of code, but these are only two lines, so it is not a big deal.

odrobnik commented 10 years ago

Please see #73 - this is a more complete solution that you probably like

MacMannes commented 10 years ago

Thanks,

I like that solution very much.. I totally missed the issue with initWithTitle:message:delegate:cancelButtonTitle:otherButtonTitles:, because I didn't use that one in my code.