gpt4 book ai didi

ios - 执行 segue 不工作

转载 作者:塔克拉玛干 更新时间:2023-11-02 09:28:22 26 4
gpt4 key购买 nike

我正在开发这个应用程序,它运行得非常好,然后我尝试运行该应用程序,但不明白为什么 segue 没有运行,因为它在应用程序打开时总是应该运行。然后我按下一个执行相同 segue 的按钮,应用程序将崩溃。

这是错误信息:

2014-04-04 16:30:54.733 On Tour Company[3854:60b] You've implemented -[<UIApplicationDelegate> application:didReceiveRemoteNotification:fetchCompletionHandler:], but you still need to add "remote-notification" to the list of your supported UIBackgroundModes in your Info.plist.

2014-04-04 16:30:55.043 On Tour Company[3854:60b] Current user: (null)

2014-04-04 16:30:55.246 On Tour Company[3854:60b] Push notifications are not supported in the iOS Simulator.

2014-04-04 16:31:00.593 On Tour Company[3854:60b] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<LoginViewController 0x9bad0e0> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key barSignUp.'

*** First throw call stack:

(
0 CoreFoundation 0x02af11e4 __exceptionPreprocess + 180

1 libobjc.A.dylib 0x023b48e5 objc_exception_throw + 44

2 CoreFoundation 0x02b80fe1 -[NSException raise] + 17

3 Foundation 0x02074d9e -[NSObject(NSKeyValueCoding) setValue:forUndefinedKey:] + 282

4 Foundation 0x01fe11d7 _NSSetUsingKeyValueSetter + 88

5 Foundation 0x01fe0731 -[NSObject(NSKeyValueCoding) setValue:forKey:] + 267

6 Foundation 0x02042b0a -[NSObject(NSKeyValueCoding) setValue:forKeyPath:] + 412

7 UIKit 0x0132b1f4 -[UIRuntimeOutletConnection connect] + 106

8 libobjc.A.dylib 0x023c67de -[NSObject performSelector:] + 62

9 CoreFoundation 0x02aec76a -[NSArray makeObjectsPerformSelector:] + 314

10 UIKit 0x01329d4d -[UINib instantiateWithOwner:options:] + 1417

11 UIKit 0x015d88bd -[UIStoryboard instantiateViewControllerWithIdentifier:] + 220

12 UIKit 0x015d8eb6 -[UIStoryboardSegueTemplate _perform:] + 88

13 UIKit 0x0119541c -[UIViewController performSegueWithIdentifier:sender:] + 72

14 On Tour Company 0x000076bf -[BlogTableViewController logout:] + 143

15 libobjc.A.dylib 0x023c6880 -[NSObject performSelector:withObject:withObject:] + 77

16 UIKit 0x010763b9 -[UIApplication sendAction:to:from:forEvent:] + 108

17 UIKit 0x013638df -[UIBarButtonItem(UIInternal) _sendAction:withEvent:] + 139

18 libobjc.A.dylib 0x023c6880 -[NSObject performSelector:withObject:withObject:] + 77

19 UIKit 0x010763b9 -[UIApplication sendAction:to:from:forEvent:] + 108

20 UIKit 0x01076345 -[UIApplication sendAction:toTarget:fromSender:forEvent:] + 61

21 UIKit 0x01177bd1 -[UIControl sendAction:to:forEvent:] + 66

22 UIKit 0x01177fc6 -[UIControl _sendActionsForEvents:withEvent:] + 577

23 UIKit 0x01177243 -[UIControl touchesEnded:withEvent:] + 641

24 UIKit 0x010b5ddd -[UIWindow _sendTouchesForEvent:] + 852

25 UIKit 0x010b69d1 -[UIWindow sendEvent:] + 1117

26 UIKit 0x010885f2 -[UIApplication sendEvent:] + 242

27 UIKit 0x01072353 _UIApplicationHandleEventQueue + 11455

28 CoreFoundation 0x02a7a77f __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 15

29 CoreFoundation 0x02a7a10b __CFRunLoopDoSources0 + 235

30 CoreFoundation 0x02a971ae __CFRunLoopRun + 910

31 CoreFoundation 0x02a969d3 CFRunLoopRunSpecific + 467

32 CoreFoundation 0x02a967eb CFRunLoopRunInMode + 123

33 GraphicsServices 0x02a1a5ee GSEventRunModal + 192

34 GraphicsServices 0x02a1a42b GSEventRun + 104

35 UIKit 0x01074f9b UIApplicationMain + 1225

36 On Tour Company 0x0000316d main + 141

37 libdyld.dylib 0x03642701 start + 1

)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)

这里是这个集合中第一个 View Controller 的代码。在 View 下的 View 中将加载(使用解析后端)我检查谁登录了应用程序,如果没有人应该去登录屏幕。我不知道为什么不是。

#import "BlogTableViewController.h"

@interface BlogTableViewController ()

@end

@implementation BlogTableViewController

-(void) viewDidLoad {
[super viewDidLoad];
[self.tabBarController.tabBar setHidden:NO];

}

-(void) viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
[self.tabBarController.tabBar setHidden:NO];

PFUser *currentUser = [PFUser currentUser];
if ([currentUser isEqual: @"nil"]) {
[self performSegueWithIdentifier: @"showLogin" sender: self];

}
else{
NSLog(@"Current user: %@", currentUser.username);
}
}


#pragma mark - Table view data source

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{

// Return the number of sections.
return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{

// Return the number of rows in the section.
return 1;
}


- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"Cell"
forIndexPath:indexPath];

// Configure the cell...

return cell;
}




- (IBAction)logout:(id)sender {
[PFUser logOut];
[self performSegueWithIdentifier: @"showLogin" sender: self];

}
@end

这里只是为了以防万一它有帮助是转场的代码。大多数代码都与使用解析后端登录用户有关,但在这里。

#import "LoginViewController.h"

@interface LoginViewController ()

@end

@implementation LoginViewController



- (void)viewDidLoad
{
[super viewDidLoad];
NSLog(@"Hello");
[self.tabBarController.tabBar setHidden:YES];
}

- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
[self.usernameField resignFirstResponder];
[self.passwordField resignFirstResponder];
}



- (IBAction)login:(id)sender {
NSString *username = self.usernameField.text;
NSString *password = [self.passwordField.text stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];

if ([username length] == 0 || [password length] == 0) {
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Oops!" message:@"Make sure you enter a username and password!"delegate:nil cancelButtonTitle:@"Ok" otherButtonTitles:nil, nil];

[alertView show];
}
else{
[PFUser logInWithUsernameInBackground:username password:password block:^(PFUser *user, NSError *error) {
if (error) {
UIAlertView *alertView = [[UIAlertView alloc]initWithTitle:@"Sorry!" message:[error.userInfo objectForKey:@"error"] delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];
[alertView show];
}
else{
[self.navigationController popToRootViewControllerAnimated:YES];
}
}];
}

}

@end

最佳答案

在 Interface Builder 中检查您的 socket 。看起来 barSignUp socket 连接错误。

关于ios - 执行 segue 不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22872882/

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