Cool Edit: Aren't you supposed to add %orig; to this function?
%hook AppDelegate
- (void)applicationDidBecomeActive:(id)application {
NSUserDefaults *validate = [NSUserDefaults standardUserDefaults];
NSString *alreadyRun = @"already_run";
if ([validate boolForKey:alreadyRun])
return;
[validate setBool:YES forKey:alreadyRun];
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Test Title"
message:@"Test Message" delegate:nil cancelButtonTitle:@"Close Test Pop-Up"
otherButtonTitles:nil];
[alert show];
[alert release];
}
%end
Also, I think you place the %new outside of the function
%hook AppDelegate
-(BOOL)application:(id)fp8 didFinishLaunchingWithOptions:(id)fp12 {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Test Title"
message:@"Test Message" delegate:self cancelButtonTitle:@"Close Test Pop-Up" otherButtonTitles:@"Test Link", nil];
[alert show];
[alert release];
return %orig();
%new
}
-(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex {
if(buttonIndex !=alertView.cancelButtonIndex)
{
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"http://www.test.com"]];
}
}
%end