我是一名高中學生,我全新的編碼和我有一個短班,我選擇嘗試爲我的學校創建一個應用程序我已經成功與我的大部分編碼,但我有連續的錯誤,預期的標識符或'('。我在互聯網上搜索,我還沒有找到一種方法來清除錯誤。預期標識符或'('錯誤
所以,我做了兩個單獨的代碼,複製和現在它們粘貼在一起,同樣的錯誤顯示出來
錯誤:。預計標識符或「(」
@interface ViewController()
<UIWebViewDelegate>
@end
@implementation ViewController
@synthesize webView;
- (void)viewDidLoad
{
[super viewDidLoad];
webView.delegate = self;
NSURL *url = [NSURL URLWithString:@"https://twitter.com/u_bett"];
NSURLRequest *urlrequest = [NSURLRequest requestWithURL:url];
[webView loadRequest:urlrequest];
}
- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType
{
if(navigationType == UIWebViewNavigationTypeLinkClicked)
{
return NO;
}
return YES;
}
{ //exected identifier or '('
[self.ScrollView setScrollEnabled: YES];
[self.ScrollView setContentSize: CGSizeMake(320, 900)];
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
- (IBAction)Twitter:(id)sender {NSURL *myURL = [NSURL URLWithString:@"https://twitter.com/u_bett"];
NSURLRequest *myRequest = [NSURLRequest requestWithURL:myURL];
[webView loadRequest:myRequest];
}
- (IBAction)Facebook:(id)sender {
NSURL *myURL = [NSURL URLWithString:@"https://www.facebook.com/BettSchools"];
NSURLRequest *myRequest = [NSURLRequest requestWithURL:myURL];
[webView loadRequest:myRequest]; }
編輯: 我照你說的做了,它在代碼的BOOL部分給了我幾個錯誤。如下所示。 }
- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType
//Expected ';' after expression
//use of undeclared identifier 'request'
{
if(navigationType == UIWebViewNavigationTypeLinkClicked)
{
return NO;
}
return YES;
}
這有什麼好做的Xcode - 這是編譯器錯誤。 – 2013-12-11 16:03:59
另外,縮進你的代碼。這是一個難以理解的混亂。 – 2013-12-11 16:04:45
Ctrl-I位於要縮進的代碼塊上。 – Rob