2
보존/상태 복원을 테스트 할 때 홈 버튼을 사용하여 백그라운드에 앱을 넣을 때 이와 같은 로그 경고가 여러 번 표시됩니다.고유 키를 사용하는 NSKeyed 아카이버 경고
2014-02-13 20:13:08.275 FlowTrak[16777:60b] *** NSKeyedArchiver warning: replacing existing
value for key 'UIStateRestorationViewControllerStoryboard'; probable duplication of encoding
keys in class hierarchy
앱이 기기에 잘 실행하고 상태 복원/보존의 모두가 정상적으로 작동하지만, 나는 이러한 경고를 제거 싶어요. 거기에 이러한 경고에 대한 정보가별로 없지만 내가 읽은 것부터, 내가 보존하고있는 각 UI 항목에 대해 고유 한 키를 사용하는 한 오랫동안 사용하면 좋을 것입니다.
이 문제를 해결하기위한 아이디어가 있습니까? 감사.
// Restoration of text fields
-(void)encodeRestorableStateWithCoder:(NSCoder *)coder
{
// start level text
[coder encodeObject:_startLevel.text forKey:@"startText"];
[super encodeRestorableStateWithCoder:coder];
// stop level text
[coder encodeObject:_stopLevel.text forKey:@"stopText"];
[super encodeRestorableStateWithCoder:coder];
// start time label
[coder encodeObject:_startTimeLabel.text forKey:@"startTimeText"];
[super encodeRestorableStateWithCoder:coder];
// stop time label
[coder encodeObject:_stopTimeLabel.text forKey:@"stopTimeText"];
[super encodeRestorableStateWithCoder:coder];
// minute rate label
[coder encodeObject:_minuteRateLabel.text forKey:@"minuteRateText"];
[super encodeRestorableStateWithCoder:coder];
// start segmented control
[coder encodeInteger:self.startFractionControl.selectedSegmentIndex forKey:@"startIndex"];
[super encodeRestorableStateWithCoder:coder];
// stop segmented control
[coder encodeInteger:self.stopFractionControl.selectedSegmentIndex forKey:@"stopIndex"];
[super encodeRestorableStateWithCoder:coder];
// start button state
[coder encodeBool:self.start.enabled forKey:@"startButtonState"];
[super encodeRestorableStateWithCoder:coder];
// stop button state
[coder encodeBool:self.stop.enabled forKey:@"stopButtonState"];
[super encodeRestorableStateWithCoder:coder];
// calculate button state
[coder encodeBool:self.calculate.enabled forKey:@"calculateButtonState"];
[super encodeRestorableStateWithCoder:coder];
// resume button state
[coder encodeBool:self.resume.enabled forKey:@"resumeButtonState"];
[super encodeRestorableStateWithCoder:coder];
// tank selector segmented control
[coder encodeInteger:self.tankControl.selectedSegmentIndex forKey:@"tankIndex"];
[super encodeRestorableStateWithCoder:coder];
// start time for equation
[coder encodeDouble:startTime forKey:@"startTimeEquation"];
[super encodeRestorableStateWithCoder:coder];
// stop time for equation
[coder encodeDouble:stopTime forKey:@"stopTimeEquation"];
[super encodeRestorableStateWithCoder:coder];
// start segmented control for equation
[coder encodeObject:startFractions forKey:@"startFractionsEquation"];
[super encodeRestorableStateWithCoder:coder];
// stop segmented control for equation
[coder encodeObject:stopFractions forKey:@"stopFractionsEquation"];
[super encodeRestorableStateWithCoder:coder];
// tank selector segmented control for equation
[coder encodeBool:bigTank forKey:@"bigTankEquation"];
[super encodeRestorableStateWithCoder:coder];
}
-(void)decodeRestorableStateWithCoder:(NSCoder *)coder
{
// start level text
_startLevel.text = [coder decodeObjectForKey:@"startText"];
[super decodeRestorableStateWithCoder:coder];
// stop level text
_stopLevel.text = [coder decodeObjectForKey:@"stopText"];
[super decodeRestorableStateWithCoder:coder];
// start time label
_startTimeLabel.text = [coder decodeObjectForKey:@"startTimeText"];
[super decodeRestorableStateWithCoder:coder];
// stop time label
_stopTimeLabel.text = [coder decodeObjectForKey:@"stopTimeText"];
[super decodeRestorableStateWithCoder:coder];
// minute rate label
_minuteRateLabel.text = [coder decodeObjectForKey:@"minuteRateText"];
[super decodeRestorableStateWithCoder:coder];
// start segmented control
self.startFractionControl.selectedSegmentIndex = [coder decodeIntegerForKey:@"startIndex"];
[super decodeRestorableStateWithCoder:coder];
// stop segmented control
self.stopFractionControl.selectedSegmentIndex = [coder decodeIntegerForKey:@"stopIndex"];
[super decodeRestorableStateWithCoder:coder];
// start button state
self.start.enabled = [coder decodeBoolForKey:@"startButtonState"];
[super decodeRestorableStateWithCoder:coder];
// stop button state
self.stop.enabled = [coder decodeBoolForKey:@"stopButtonState"];
[super decodeRestorableStateWithCoder:coder];
// calculate button state
self.calculate.enabled = [coder decodeBoolForKey:@"calculateButtonState"];
[super decodeRestorableStateWithCoder:coder];
// resume button state
self.resume.enabled = [coder decodeBoolForKey:@"resumeButtonState"];
[super decodeRestorableStateWithCoder:coder];
// tank selector segmented control
self.tankControl.selectedSegmentIndex = [coder decodeIntegerForKey:@"tankIndex"];
[super decodeRestorableStateWithCoder:coder];
// start time for equation
startTime = [coder decodeDoubleForKey:@"startTimeEquation"];
[super decodeRestorableStateWithCoder:coder];
// stop time for equation
stopTime = [coder decodeDoubleForKey:@"stopTimeEquation"];
[super decodeRestorableStateWithCoder:coder];
// start segmented control for equation
startFractions = [coder decodeObjectForKey:@"startFractionsEquation"];
[super decodeRestorableStateWithCoder:coder];
// stop segmented control for equation
stopFractions = [coder decodeObjectForKey:@"stopFractionsEquation"];
[super decodeRestorableStateWithCoder:coder];
// calculate button state
bigTank = [coder decodeBoolForKey:@"bigTankEquation"];
[super decodeRestorableStateWithCoder:coder];
}