Ok, well, today, I've just released my first free version of my app. It give the first 100 for free, but you need to pay for the rest. But, I need to make it clearer when you run out, like an alert. As it stands now, you just have to keep repeating, trying to figure out why you're stuck. I went through 3 of the same quiz before I finally got it, and I wrote the program.
So, the goal of today is to put in an alert. I also want to put in some metrics.
Woah - thank God. A gang of like 20 high school girls just decided *not* to sit right next to me. That was a close call.
Oh, yeah, I almost forgot. Since I upgraded to Xcode 4.2, I've been getting warnings from the Reachability class:
declaration of '…' will not be visible outside of this function warning
Stackoverflow as usual has the solution:
Add #import <netinet/in.h> in Reachability.h to get away with this
Ok, there are still a couple of other warnings.
I'm getting an incompatible pointer warning on this:
UIScrollView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 0, 0)];
If I click on the warning, it takes me to the class itself, which returns a UIView. So casting it to a UIScrollView eliminates the problem:
UIScrollView *view = (UIScrollView *) [[UIView alloc] initWithFrame:CGRectMake(0, 0, 0, 0)];
Ok, good. Now, the last warning is
"initwithframe reuseidentifier is deprecated" from this statement:
cell = [ [[UITableViewCell alloc]
initWithFrame:CGRectZero reuseIdentifier:@"cell"] autorelease];
The fix, again from stackoverflow, is this:
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"cell"] autorelease];
Whew! That was pain.
Ok, where was I? Ok, first, let's throw in the alert.
Here's where I want to throw it in:
if (reachedEndOfFreeWords) {
if ([Utils isFreeVersion]) {
self.upperCongratsMessage.text = @"Free vocabualary completed!";
self.congratsMessage.text = @"Click the buy button below for the rest!";
=========> create the alert here! <=====================
}
else {
self.congratsMessage.text = @"You have completed *all* the words!";
}
}
Ok, let's get some alert code. Where do we have it? Hmm...right - there's an alert if you don't get all the question right.
Ah, here it is:
// construct a message letting the user know how many were wrong
NSString *title = [NSString stringWithFormat:@"You answered %d out %d correctly",appState.correctAnswers, [appState.shuffledQuestionDictKeyList count]];
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:title
message:@"To advance, all answers must be correct"
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[alert show];
[alert release];
So, let's make this look like this:
// construct a message to the user
NSString *title = [NSString stringWithFormat:@"Press the
\"Buy\" button below for the rest of the questions!";
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:title
message:@"Congratulations - free questions completed."
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[alert show];
[alert release];
Ok, with that taken care of, let's set up the metrics.
Pretty easy - copy the libFlurryAnalytics.a into the project, copy the FlurryAnalytics.h into the app delegate implementation file, and the start session in the "application:didFinishLaunchingWithOptions method:
[FlurryAnalytics startSession:@"YOUR_KEY_GOES_HERE"];
Ok, that's a wrap. Check out the ads!
No comments:
Post a Comment