Ios 对于';没有可见的@界面;论坛';声明选择器';返回最后一页';
所以我对xCode非常陌生,如果有人能帮我做这件事,我会很有帮助的 我正在创建一个在大多数情况下都非常简单的应用程序。我有一个Ios 对于';没有可见的@界面;论坛';声明选择器';返回最后一页';,ios,objective-c,facebook,uiwebview,Ios,Objective C,Facebook,Uiwebview,所以我对xCode非常陌生,如果有人能帮我做这件事,我会很有帮助的 我正在创建一个在大多数情况下都非常简单的应用程序。我有一个UIWebView将我带到一个移动页面。此页面有一个登录Facebook。我遇到的最初问题是,由于它是一个移动站点,登录完成后,我会看到一个空白屏幕。我需要UIWebView将我带回我单击的登录处的原始登录。我已经复制了一些代码,我认为这些代码可以工作,但我犯了一个错误 “对于'forum'没有可见的@interface声明选择器'backToLastPage'” 有人能
UIWebView
将我带到一个移动页面。此页面有一个登录Facebook
。我遇到的最初问题是,由于它是一个移动站点,登录完成后,我会看到一个空白屏幕。我需要UIWebView
将我带回我单击的登录处的原始登录。我已经复制了一些代码,我认为这些代码可以工作,但我犯了一个错误
“对于'forum'没有可见的@interface声明选择器'backToLastPage'”
有人能告诉我需要做什么来解决这个问题吗?这可能很简单,但我需要一些帮助
#import "forum.h"
#import "ViewController.h"
@interface forum ()
@end
@implementation forum
-(IBAction)switchback:(id)sender {
[self dismissViewControllerAnimated:YES completion:nil];
}
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self;
}
- (void)viewDidLoad
{
[super viewDidLoad];
NSURL *myURL = [NSURL URLWithString:@"http://www.moot.it/yopyipcommunity"];
NSURLRequest *myRequest = [NSURLRequest requestWithURL:myURL];
[myWebView loadRequest:myRequest];
}
- (BOOL)webView:(UIWebView *)webView
shouldStartLoadWithRequest:(NSURLRequest *)request
navigationType:(UIWebViewNavigationType)navigationType
{
NSString *url = [[request URL] absoluteString];
//when user status == connected
//(has a access_token at facebook oauth response)
if([url hasPrefix:@"https://m.facebook.com/dialog/oauth"] &&
[url rangeOfString:@"access_token="].location != NSNotFound)
{
[self backToLastPage];
return NO;
}
return YES;
}
- (void)webViewDidFinishLoad:(UIWebView *)webView
{
NSString *url = [[webView.request URL] absoluteString];
if([url hasPrefix:@"https://m.facebook.com/dialog/oauth"])
{
NSString *bodyHTML =
[webView stringByEvaluatingJavaScriptFromString:@"document.body.innerHTML"];
//Facebook oauth response dead end:
// is a blank body and a head with a script that does
//nothing. But if you got back to your last page,
// the handler of authResponseChange
//will catch a connected status
// if user did his login and auth app
if([bodyHTML isEqualToString:@""])
{
[self backToLastPage];
}
}
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end
我认为forum.h是单独的类,backToLastPage方法在该类中声明
@property (nonatomic, strong) forum *forum;
您需要为该类创建分配
self.forum = [forum alloc]init];
您可以这样调用该方法,[self.forum backToLastPage]代码>
相反,[self backToLastPage]代码>我应该在哪里发布self.forum=[forum alloc]init]?在viewDidLoad方法中,我是只是复制并通过它,还是需要其他东西?我试着复制和粘贴它,它给了我错误。什么错误?您在哪里实现了这个方法backToLastPage?我把self.forum=[forum alloc]init];就在[self.forum backToLastPage]上方;我得到了和以前一样的错误。我还把@property(非原子,强)放到论坛*论坛;在我的.h文件中。