Update
I swapped out completely different code for pushViewController, and it is still crashing… seems like pushViewController is not the culprit. Here is what I added instead:
NSString *videoURL = [[NSString alloc] initWithFormat:@"http://www.vimeo.com/m/#/%@", videoID];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:videoURL]];
It opens up the URL in Safari, and then crashes.. wtf?
PushViewController crashes with no error in the console, but I do get an EXC_BAD_ACCESS error in Xcode. The crash doesn’t happen until after the view controller has been pushed… but the view its pushing is empty… no code to mess up.
My code is below:
MainViewController.m
PlayVimeo *playTest = [[PlayVimeo alloc] initWithNibName:@"PlayVimeo" bundle:nil];
//playTest.videoID = videoID;
[self.navigationController pushViewController:playTest animated:YES];
[playTest release];
PlayVimeo.m
#import "PlayVimeo.h"
#import "SVProgressHUD.h"
@implementation PlayVimeo
@synthesize videoID, wView;
-(void)viewDidLoad {
[super viewDidLoad];
//Show loading alert
[SVProgressHUD showInView:self.view status:@"Loading Video..."];
}
-(void)viewWillAppear:(BOOL)animated {
NSLog(@"Play View Loaded!");
[self vimeoVideo];
}
-(void)vimeoVideo {
NSLog(@"Video ID: %@", videoID);
NSString *html = [NSString stringWithFormat:@"<html>"
@"<head>"
@"<meta name = \"viewport\" content =\"initial-scale = 1.0, user-scalable = no, width = 460\"/></head>"
@"<frameset border=\"0\">"
@"<frame src=\"http://player.vimeo.com/video/%@?title=0&byline=0&portrait=1&autoplay=1\" width=\"460\" height=\"320\" frameborder=\"0\"></frame>"
@"</frameset>"
@"</html>",
videoID];
NSLog(@"HTML String: %@", html);
[wView loadHTMLString:html baseURL:[NSURL URLWithString:@""]];
//Dismiss loading alert
[SVProgressHUD dismissWithSuccess:@"Playing..."];
}
- (void)viewDidUnload {
[super viewDidUnload];
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return (interfaceOrientation == UIInterfaceOrientationLandscapeLeft || interfaceOrientation == UIInterfaceOrientationLandscapeRight);
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
}
-(void)dealloc {
[super dealloc];
}
Navigation Controller Code:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
self.window.rootViewController = self.navigationController;
[self.window makeKeyAndVisible];
[Appirater appLaunched];
return YES;
}
Console on crash:
sharedlibrary apply-load-rules all
Current language: auto; currently objective-c
(gdb)
It’s likely that the culprit is
Without seeing the rest of your code, I would still say that you likely need to release this after you’re done with the video.