AlertViews and NSLogs are being displayed when one class tells them to but not another?
Here's a method from my app delegate:
Again, these messages show up fine. The NSLogs show up at the right times, and the UIAlertViews show up at the right times.
In a second class,
Ads end up getting shown, which is right, but no NSLog messages are put out, and UIAlertViews aren't displayed... I've also set break points and found that those are tripped, so this method is getting used.
Any suggestions for why this isn't working?
Here's a method from my app delegate:
Code:
-(BOOL) application:(UIApplication *)application handleOpenURL:(NSURL *)url
{
if (url != nil && [url isFileURL])
{
if ([[NSDate date] timeIntervalSince1970] < 1328054400)
{
//The promotion hasn't expired yet! Read the file!
NSData *promotionalData = [NSData dataWithContentsOfURL:url];
NSString *promotionalString = [[NSString alloc] initWithData:promotionalData encoding:NSUTF8StringEncoding];
NSLog(@"%@", promotionalString);
if ([promotionalString isEqualToString:@"This Quick Clips Promo Code is good until December 14th, 2011."])
{
NSLog(@"The files match and it's not too late! Hurray!");
[self.viewController successfulPurchase];
[[NSUserDefaults standardUserDefaults] setObject:promotionalData forKey:@"promo"];
[[NSUserDefaults standardUserDefaults] synchronize];
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Promotional Code Activated!" message:@"You may use the premium version of Quick Clips for free until January 31st, 2011. Enjoy!" delegate:nil cancelButtonTitle:@"Thanks!" otherButtonTitles:nil];
[alertView show];
[alertView release];
}
else
{
NSLog(@"The files don't match. Boo!");
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Invalid Promotional Code!" message:@"Sorry, this promotional code isn't valid." delegate:nil cancelButtonTitle:@"Boo!" otherButtonTitles:nil];
[alertView show];
[alertView release];
}
}
else
{
NSLog(@"The promotion has ended. Boo!");
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Promotional Period is Over!" message:@"Sorry, this promotion has ended." delegate:nil cancelButtonTitle:@"Boo!" otherButtonTitles:nil];
[alertView show];
[alertView release];
}
}
else
{
NSLog(@"Nothing to open and read!");
}
return YES;
}
Again, these messages show up fine. The NSLogs show up at the right times, and the UIAlertViews show up at the right times.
In a second class,
Code:
- (void)verifyReceipt:(NSData *)receipt promo:(BOOL)promo
{
if ([[NSDate date] timeIntervalSince1970] < 60)
{
NSString *promotionalString = [[NSString alloc] initWithData:receipt encoding:NSUTF8StringEncoding];
NSLog(@"%@", promotionalString);
if ([promotionalString isEqualToString:@"This Quick Clips Promo Code is good until December 14th, 2011."])
{
NSLog(@"The files match and it's not too late! Hurray!");
}
else
{
NSLog(@"The files don't match. Boo!");
[[NSUserDefaults standardUserDefaults] removeObjectForKey:@"promo"];
[[NSUserDefaults standardUserDefaults] synchronize];
[self requestAds];
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Invalid Promotional Code!" message:@"Sorry, this promotional code isn't valid. Please upgrade via the help menu to continue using premium features." delegate:self cancelButtonTitle:@"No Thanks" otherButtonTitles:@"Upgrade", nil];
[alertView show];
[alertView release];
}
[promotionalString release];
}
else
{
NSLog(@"The promotion has ended. Boo!");
[[NSUserDefaults standardUserDefaults] removeObjectForKey:@"promo"];
[[NSUserDefaults standardUserDefaults] synchronize];
[self requestAds];
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Promotional Period is Over!" message:@"Sorry, the premium promotion is over. Please upgrade via the help menu to continue using premium features." delegate:self cancelButtonTitle:@"No Thanks" otherButtonTitles:@"Upgrade", nil];
[alertView show];
[alertView release];
}
}
Ads end up getting shown, which is right, but no NSLog messages are put out, and UIAlertViews aren't displayed... I've also set break points and found that those are tripped, so this method is getting used.
Any suggestions for why this isn't working?