gpt4 book ai didi

ios - PrepareForSegue 没有传递所有数据?

转载 作者:行者123 更新时间:2023-11-29 02:41:49 27 4
gpt4 key购买 nike

我正在使用模态转场将数据从 SignUpViewController 传递到 RAVerificationViewController。出于某种原因,我的姓名、密码、电话和电子邮件值为零,但宿舍和角色选择出现了(它们是从选择器中选择的值)。我看到它们从第一个 View Controller 正确传递,但它们没有出现在下一个 View Controller 中。帮助!

- (void)prepareForSegue:(UIStoryboardPopoverSegue *)segue sender:(id)sender {
NSLog(@"prepareForSegue: %@", segue.identifier);
if ([segue.identifier isEqualToString:@"signUpToRAVerification"]) {
RAVerificationViewController *ravc = (RAVerificationViewController *)segue.destinationViewController;
NSInteger roleRow = [_rolePickerChoice selectedRowInComponent:0];
NSString *role = [self pickerView: _rolePickerChoice titleForRow:roleRow forComponent:1];
ravc.role = role;
NSString *email = _emailOneField.text;
ravc.name = _nameField.text;
ravc.password = _passwordTwoField.text;
ravc.email = email;
ravc.phoneNumber = _phoneNumberField.text;
NSInteger dormRow = [_dormPickerChoice selectedRowInComponent:0];
NSString *dorm = [self pickerView: _dormPickerChoice titleForRow:dormRow forComponent:1];
ravc.dormChoice= dorm;
}
}

我对其他 VC 中的数据所做的事情:

if([_raCodeField.text isEqualToString:code]) {
NSLog(@"The email is: %@", email);
//RA good to go, let's save him/her in our DB!
PFUser* user = [PFUser user];
user[@"role"] = _role;
user[@"Name"] = name;
user.password = password;
user.email = email;
user.username = email;
user[@"phone_number"] = phoneNumber;
user[@"dorm"] = _dormChoice;
[user signUpInBackgroundWithBlock:^(BOOL succeeded, NSError *error)

对于整个 SignUpViewController:https://gist.github.com/vinamratasingal/542dc10bf1674173d2de

对于整个 raVerificationViewController:https://gist.github.com/vinamratasingal/758d3a11a3ddf6d7e3a3

最佳答案

您没有向我们展示您的 RAVerificationViewController 的头文件,但我几乎可以保证问题是您的属性正在使用 weak 属性。您需要确保它们使用 strong property 属性。

否则,数据将没有任何强引用,并且将从内存中释放。

关于ios - PrepareForSegue 没有传递所有数据?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25675538/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com