setValue:forUndefinedKey:]:此 class 与键 adDescription 的键值编码不兼容。'
setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key adDescription.'
我无法创建一种方法来向数据库创建广告和环境。错误是 "setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key adDescription.'" 这个,只有在重定向我宣布注册视图时才会发生
这是浏览记录:
#import "AddAdViewController.h"
#import "Ads.h"
#import "JVWebService.h"
#import "AppDelegate.h"
#import "JVUtils.h"
#import "AdsTableViewController.h"
@interface AddAdViewController () <JVWebServiceDelegate, UIImagePickerControllerDelegate, UINavigationControllerDelegate, UIPickerViewDelegate>
@property (nonatomic) BOOL show;
@property (strong, nonatomic) UITextField *currentTextField;
@end
@implementation AddAdViewController
- (void)viewDidLoad {
[super viewDidLoad];
}
- (IBAction)addAd:(id)sender {
if (self.adTitleField.text.length <= 0) {
[JVUtils showMessage:@"Você precisa nos informar seu nome completo." withTitle:@"Opa!"];
} else if (self.adPriceField.text.length <= 0) {
[JVUtils showMessage:@"Você precisa nos informar um e-mail para contato." withTitle:@"Opa!"];
} else if (self.adLocalField.text.length <= 0) {
[JVUtils showMessage:@"Você precisa criar uma senha para a sua conta." withTitle:@"Opa!"];
} else if (self.adDescriptionField.text.length <= 0) {
[JVUtils showMessage:@"Você precisa confirmar sua senha." withTitle:@"Opa!"];
} else {
Ads *newAd = [Ads new];
newAd.title = self.adTitleField.text;
newAd.price = self.adPriceField.text;
newAd.local = self.adLocalField.text;
newAd.description = self.adDescriptionField.text;
[[JVWebService sharedService] setServiceDelegate:self];
[[JVWebService sharedService] postAd:newAd];
}
}
#pragma mark - Bar Button Action
- (void)cancelButtonAction {
[self dismissViewControllerAnimated:YES completion:nil];
}
#pragma mark - JVWebService Delegate
- (void)successfulRequestDidReturnObject:(NSObject *)object {
[JVUtils showMessage:@"Agora você tem uma conta JáVendi! Faça o login e desfrute ao máximo do aplicativo." withTitle:@"Parabéns!"];
[[AppDelegate sharedDelegate] setCurrentUser:(User *)object];
[self dismissViewControllerAnimated:YES completion:nil];
AdsTableViewController *svc = [[UIStoryboard storyboardWithName:@"Main" bundle:[NSBundle mainBundle]] instantiateViewControllerWithIdentifier:@"LoginViewController"];
[self.navigationController presentViewController:[[UINavigationController alloc] initWithRootViewController:svc]
animated:YES
completion:nil];
}
- (void)requestDidFailWithError:(NSError *)error {
[JVUtils showMessage:error.localizedDescription withTitle:@"Erro"];
}
@end
此错误意味着您正试图在没有 adDescription 属性 的对象上设置名为 'adDescription' 的 属性。我没有看到你直接引用这个变量,所以它可能是在你的一个设置器中设置的,特别是在你制作广告的地方,或者这一行
[[AppDelegate sharedDelegate] setCurrentUser:(User *)object];
我无法创建一种方法来向数据库创建广告和环境。错误是 "setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key adDescription.'" 这个,只有在重定向我宣布注册视图时才会发生
这是浏览记录:
#import "AddAdViewController.h"
#import "Ads.h"
#import "JVWebService.h"
#import "AppDelegate.h"
#import "JVUtils.h"
#import "AdsTableViewController.h"
@interface AddAdViewController () <JVWebServiceDelegate, UIImagePickerControllerDelegate, UINavigationControllerDelegate, UIPickerViewDelegate>
@property (nonatomic) BOOL show;
@property (strong, nonatomic) UITextField *currentTextField;
@end
@implementation AddAdViewController
- (void)viewDidLoad {
[super viewDidLoad];
}
- (IBAction)addAd:(id)sender {
if (self.adTitleField.text.length <= 0) {
[JVUtils showMessage:@"Você precisa nos informar seu nome completo." withTitle:@"Opa!"];
} else if (self.adPriceField.text.length <= 0) {
[JVUtils showMessage:@"Você precisa nos informar um e-mail para contato." withTitle:@"Opa!"];
} else if (self.adLocalField.text.length <= 0) {
[JVUtils showMessage:@"Você precisa criar uma senha para a sua conta." withTitle:@"Opa!"];
} else if (self.adDescriptionField.text.length <= 0) {
[JVUtils showMessage:@"Você precisa confirmar sua senha." withTitle:@"Opa!"];
} else {
Ads *newAd = [Ads new];
newAd.title = self.adTitleField.text;
newAd.price = self.adPriceField.text;
newAd.local = self.adLocalField.text;
newAd.description = self.adDescriptionField.text;
[[JVWebService sharedService] setServiceDelegate:self];
[[JVWebService sharedService] postAd:newAd];
}
}
#pragma mark - Bar Button Action
- (void)cancelButtonAction {
[self dismissViewControllerAnimated:YES completion:nil];
}
#pragma mark - JVWebService Delegate
- (void)successfulRequestDidReturnObject:(NSObject *)object {
[JVUtils showMessage:@"Agora você tem uma conta JáVendi! Faça o login e desfrute ao máximo do aplicativo." withTitle:@"Parabéns!"];
[[AppDelegate sharedDelegate] setCurrentUser:(User *)object];
[self dismissViewControllerAnimated:YES completion:nil];
AdsTableViewController *svc = [[UIStoryboard storyboardWithName:@"Main" bundle:[NSBundle mainBundle]] instantiateViewControllerWithIdentifier:@"LoginViewController"];
[self.navigationController presentViewController:[[UINavigationController alloc] initWithRootViewController:svc]
animated:YES
completion:nil];
}
- (void)requestDidFailWithError:(NSError *)error {
[JVUtils showMessage:error.localizedDescription withTitle:@"Erro"];
}
@end
此错误意味着您正试图在没有 adDescription 属性 的对象上设置名为 'adDescription' 的 属性。我没有看到你直接引用这个变量,所以它可能是在你的一个设置器中设置的,特别是在你制作广告的地方,或者这一行
[[AppDelegate sharedDelegate] setCurrentUser:(User *)object];