gpt4 book ai didi

ios - 将数据传递到本地 html iOS webview

转载 作者:行者123 更新时间:2023-11-28 21:46:52 28 4
gpt4 key购买 nike

我试图在 Facebook 登录到我的标签栏 View Controller 后从我的 View Controller 传递,但它给了我这个错误:

'NSInvalidArgumentException', reason: 'Storyboard () doesn't contain a view controller with identifier 'dashBoardViewController''

这是方法:

- (void)loginViewFetchedUserInfo:(FBLoginView *)loginView
user:(id<FBGraphUser>)user {

NSString *userName = [user first_name];
NSString *userId = [user id];


dashBoardViewController *dashBoardViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"dashBoardViewController"];
dashBoardViewController.first_name = userName;
dashBoardViewController.id = userId;
[self presentModalViewController:dashBoardViewController animated:YES];
}

编辑

//
// ViewController.m
// LoginSampleFB
//
//

#import "ViewController.h"
#import "dashBoardViewController.h"
#import "BFPaperTabBarController.h"
#import <FacebookSDK/FacebookSDK.h>


@interface ViewController ()



@end

@implementation ViewController



- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.

self.loginButton.delegate = self;
self.loginButton.readPermissions = @[@"public_profile", @"email", @"publish_actions",];

}

- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}





- (void)loginViewFetchedUserInfo:(FBLoginView *)loginView
user:(id<FBGraphUser>)user {

NSString *userName = [user first_name];
NSString *userId = [user id];



dashBoardViewController *dashBoardViewController = [[UIStoryboard storyboardWithName:@"Main" bundle:nil] instantiateViewControllerWithIdentifier:@"dashBoardViewController"];
dashBoardViewController.first_name = userName;
dashBoardViewController.id = userId;
[self presentModalViewController:dashBoardViewController animated:YES];
}



-(void)loginView:(FBLoginView *)loginView handleError:(NSError *)error{
NSLog(@"%@", [error localizedDescription]);
}


@end

//
// ViewController.h
// LoginSampleFB
//
// Created by Gabriel Theodoropoulos on 12/5/14.
// Copyright (c) 2014 Appcoda. All rights reserved.
//

#import <UIKit/UIKit.h>
#import <FacebookSDK/FacebookSDK.h>
#import "BFPaperTabBarController.h"

@interface ViewController : UIViewController <FBLoginViewDelegate>

@property (weak, nonatomic) IBOutlet FBLoginView *loginButton;

@property (weak, nonatomic) IBOutlet UIButton *showEvent;

@property (weak, nonatomic) IBOutlet UIButton *goQrcode;

@property (retain, nonatomic) NSString *id;

@property (retain, nonatomic) NSString *first_name;


@end

请向上

最佳答案

你应该看看这个 stackoverflow 主题,这是同一个问题。

UIStoryboard Couldn't find view controller with identifier

恢复:

  1. 检查并确保在 Storyboard中设置了 Controller 类和 Storyboard ID。 (请参阅与我的答案相关的主题中的图片)

    自定义类 |类:dashBoardViewController

    身份 | Storyboard ID:dashBoardViewController

  2. 如果是,但仍然无法正常工作,请尝试从 iPhone 模拟器或测试设备中删除您的应用程序,清理您的项目,构建并运行它。

  3. 如果错误仍然存​​在:尝试使用 [[UIStoryboard storyboardWithName:@"nameofyourstoryboard"bundle:nil] instantiateViewControllerWithIdentifier:@"dashBoardViewController"] 而不是 self.storyboard。您一定会拥有这样的正确对象。

  4. 还是不行?从你的 Storyboard中删除你的 Controller 并尝试重新创建一个新的。有时它会发生...

关于ios - 将数据传递到本地 html iOS webview,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29818675/

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