【发布时间】:2011-12-07 08:36:08
【问题描述】:
我对 ios 非常陌生。
我正在尝试学习 appDelegate 方法来在我的应用程序中传递数据。当我为变量(appDelegate 变量)设置值时,它确实在那个时间点设置了它 但经过 2 个步骤后,它显示它超出范围。 当我这样做时检索它
myAppDelegate *appDelegate = (myAppDelegate *)[[UIApplication sharedApplication] delegate];
myClass *my = [appDelegate.myclass objectAtIndex:0];
它说明了我的一些 myClass 属性。(使用断点和随机数进行检查,有时是第一次,第二次是第三次)。
有谁知道我错过了什么??? 感谢您的帮助 ! :)
【问题讨论】:
-
你能提供更多细节吗? appDelegate.myclass 是如何定义的?有时调试器无法很好地显示变量内容,当您使用 NSLog 打印变量内容时会发生什么?
-
我使用了一个断点进行检查,它确实具有正确的值。 UserProfile *up = [[[UserProfile alloc] init]initWithUsername:un 密码:pd 地址:ad zipcode:zip email:em emailSetting:es calenderSetting:cs]; [self.userprofile addObject:up]; self.userprofile 是我的变量。 up 变量完全没问题!
-
你能把你的问题的更多细节发给我吗...
标签: iphone ios uiapplicationdelegate