我遇到了一个问题 - 尝试设置 UIWebView.delegate = self; 时出现 EXC_BAD_ACCESS;
我的代码:
vkLogin.h -
#import UIKit/UIKit.h
@interface vkLogin : UIViewController <UIWebViewDelegate>
{
UIWebView *authBrowser;
UIActivityIndicatorView *activityIndicator;
}
@property (nonatomic, retain) UIWebView *authBrowser;
@property (nonatomic, retain) UIActivityIndicatorView *activityIndicator;
@end
vkLogin.m -
#import "vkLogin.h"
#import "bteamViewController.h"
@implementation vkLogin
@synthesize authBrowser;
- (void) viewDidLoad
{
[super viewDidLoad];
activityIndicator = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];
activityIndicator.center = CGPointMake(self.view.bounds.size.width / 2, self.view.bounds.size.height / 2);
activityIndicator.autoresizesSubviews = YES;
activityIndicator.hidesWhenStopped = YES;
[self.view addSubview: activityIndicator];
[activityIndicator startAnimating];
authBrowser = [[UIWebView alloc] initWithFrame:self.view.bounds];
authBrowser.delegate = self;
authBrowser.scalesPageToFit = YES;
[self.view addSubview:authBrowser];
NSString *authLink = @"http://api.vk.com/oauth/authorize?client_id=-&scope=audio&redirect_uri=http://api.vk.com/blank.html&display=touch&response_type=token";
NSURL *url = [NSURL URLWithString:authLink];
[authBrowser loadRequest:[NSURLRequest requestWithURL:url]];
}
- (void) webViewDidFinishLoad:(UIWebView *)authBrowser
{
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Lol" message:@"OLOLO" delegate:self cancelButtonTitle:@"Okay" otherButtonTitles:nil, nil];
[alert show];
}
@end
所以,如果我正在处理委托字符串 - 一切正常,但我没有收到我的 webViewDidFinishLoad 事件。
我做错了什么?