我寫這段代碼:的iOS指向指針的NSMutableDictionary
- (void) addKey:(NSString *)key inMessage:(DEMessage *)message to:(NSMutableDictionary * __autoreleasing *)to
{
if ([message getPropertyByPath:key]) {
[*to setObject:@([[message getPropertyValue:key] floatValue]) forKey:key];
}
}
這一點我通過撥打:
NSMutableDictionary *statistics = [NSMutableDictionary new];
[self addKey:@"Yellow" inMessage:message to:&statistics];
[self addKey:@"Red" inMessage:message to:&statistics];
[self addKey:@"Matches" inMessage:message to:&statistics];
[self addKey:@"Goals" inMessage:message to:&statistics];
[self addKey:@"GoalsPerMatch" inMessage:message to:&statistics];
[self addKey:@"Faults" inMessage:message to:&statistics];
[self addKey:@"Expelled" inMessage:message to:&statistics];
_statistics = [statistics copy];
我寫的就是這麼刪除重複代碼的方法。唯一的問題是,當我使用開發證書構建它時,一切都很好,但是當我使用生產/臨時證書時,它會在這件事上崩潰。
我收到的錯誤是段錯誤11.對我說,我正在使用不是我的內存。我沒有得到這個...
所以,問題是:「爲什麼在生產/特設證明我的程序崩潰,爲什麼是我的代碼不正確提前
感謝,
問題是:你爲什麼傳遞一個指針指針? :0 – 2014-09-02 07:18:18
另外,那是什麼'@([[message getPropertyValue:key] floatValue])'?這是完全多餘的,不可讀和不必要的。 – 2014-09-02 07:19:48
@TheParamagneticCroissant有些人使用這個庫並不是難以理解的,這就是問題的焦點 – Haagenti 2014-09-02 07:23:48