のリリース構成でループ「のための」無限の私は自分のアプリケーションで次のコードを持っている:は、iPhoneアプリ
NSArray *lstAttributes = [conditionAttribute componentsSeparatedByString:cstrSystemUIConfigurationAttributeConditionSeparator],
*lstValues = [conditionValue componentsSeparatedByString:cstrSystemUIConfigurationAttributeConditionSeparator],
*lstValueTypes = [conditionValueType componentsSeparatedByString:cstrSystemUIConfigurationAttributeConditionSeparator];
if([lstAttributes count] != [lstValues count] ||
[lstAttributes count] != [lstValueTypes count]) return NO;
BOOL bResult = YES;
NSLog(@"attributes amount - %u", [lstAttributes count]);
for(uint i = 0; i < [lstAttributes count]; i ++)
{
NSLog(@"counter: %u", i);
SystemUIConfigurationAttributeCondition *condition = [SystemUIConfigurationAttributeCondition new];
condition.conditionAttribute = [lstAttributes objectAtIndex:i];
condition.conditionValue = [lstValues objectAtIndex:i];
condition.conditionValueType = [lstValueTypes objectAtIndex:i];
bResult &= [self checkCondition:condition forOwner:owner];
FreeObject(&condition);
if(!bResult) break;
}
return bResult;
すべてが「デバッグ」の構成で結構です。しかし、一度それを "リリース"に切り替えると、私は無限ループに直面します。コンソールは私に、属性量-2、カウンタ0、カウンタ1、カウンタ1、カウンタ1、カウンタ1、カウンタ1、カウンタ1、......などを表示します。
私は異なる "for"と "while"演算子を使いこなそうとしましたが、何も正しく動作しませんでした。ループはまだ停止できません。
誰も以前に同じ問題に直面していますか?
私は客観的に奇妙なものがありましたが、それほど奇妙なものはありませんでした。私は、ループ内のすべての操作の後にiの値をトレースすることを提案することができます。したがって、ループ内のどこかで0にディクリメント/リセットされるかどうかを確認してください。そうでない場合は、for()ステートメント自体で奇妙です。 – iandotkelly
これをコメントアウトしてみてください。 bResult&= [self checkCondition:condition forOwner:owner]; –
あなたは試しましたか? 'for(int i = 0; i <[lstAttributes count]; i ++)... ' –