我想重复我在单独的视图控制器中的两种方法。这是我的代码(如果代码不清楚解释情况,请添加注释):
第一个视图控制器:
-(void)GettingVariable {
NSString *VariableGotFromSVC = [(AppDelegate *)[[UIApplication sharedApplication] delegate] VariableGotFromSVC;
NSNumberFormatter * NsFormatterMethod= [[NSNumberFormatter alloc] init];
[NsFormatterMethod setNumberStyle:NSNumberFormatterDecimalStyle];
myNumberVariable = [NsFormatterMethod numberFromString:VariableGotFromSVC];
if (!myNumberVariable) {
Ayarlar *SecondVC = [[Ayarlar alloc]init];
[SecondVC performSelector:@selector(touchesBegan:withEvent:)];
}
NSLog(@"mynumbervariable:%@", myNumberVariable);
}
第二个视图控制器:
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
[self.view endEditing:YES];
[(AppDelegate *)[[UIApplication sharedApplication] delegate] setVariable:VariableTextField.text];
MekanListesi *FirstVC=[[MekanListesi alloc]init];
[FirstVC GettingVariable];
}
该代码与该消息一起崩溃:
0x1e640b0: cmpl (%eax), %ecx