Discussion Forums  >  Plugins, Customizing, Source Code

Replies: 11    Views: 54

Becky
I hate code!
Profile
Posts: 269
Reg: Aug 08, 2012
NYC
6,140
05/09/14 07:26 PM (10 years ago)

Reminder List - Error

I'm trying to implement the final piece of code needed to get the Reminder List running and I receive a couple of errors. Any help would be greatly appreciated:) https://www.dropbox.com/s/4s4fwpwr56ze7yk/Screen%20Shot%202014-05-09%20at%207.19.29%20PM.png
 
Becky
I hate code!
Profile
Posts: 269
Reg: Aug 08, 2012
NYC
6,140
like
05/09/14 08:11 PM (10 years ago)
Also, upon opening the control panel on my server, it says "There was a problem reading the saved JSON data for this screen.
 
ATRAIN53
Code is Art
Profile
Posts: 1755
Reg: Nov 17, 2011
Chicago
26,450
like
05/10/14 08:36 AM (10 years ago)
Greetings- Thanks for checking out the plugin, hope it's useful :) 1) The problem here is that you're trying to add a method inside a method. This snippet: //ATReminder NSNotification code UILocalNotification *locationNotification = [launchOptions objectForKey:UIApplicationLaunchOptionsLocalNotificationKey]; if (locationNotification) { // Set icon badge number to zero application.applicationIconBadgeNumber = 0; } Goes INSIDE the "didFinishLaunchingWithOptions method" Just cut and paste those 7 lines below the start of the method which starts here: -(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions{ [BT_debugger showIt:self message:[NSString stringWithFormat:@"didFinishLaunchingWithOptions%@", @""]]; and drop them right below that line 2) This is a NEW method you are adding to your appDelegate: Add this code right after the didFinishLaunchingWithOptions method: - (void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification { UIApplicationState state = [application applicationState]; if (state == UIApplicationStateActive) { UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Reminder" message:notification.alertBody delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil]; [alert show]; } // Request to reload table view data [[NSNotificationCenter defaultCenter] postNotificationName:@"reloadData" object:self]; // Set icon badge number to zero application.applicationIconBadgeNumber = 0; } That will fix those errors. If you want to send me your appDelegate file I can fix it for you. My email is in the code. 3) The problem reading JSON could be a lot of things. Look for a use of , or ' in your screen names - that is usually when I see that error. The easiest thing might be to just delete the screen and then refresh your JSON data if this screen is causing problems. Then try adding it again. Also, if you copy your BT_config.txt file and paste it into here http://jsonlint.com Is it valid or does it show errors?
 
Becky
I hate code!
Profile
Posts: 269
Reg: Aug 08, 2012
NYC
6,140
like
05/10/14 02:46 PM (10 years ago)
Hi Atrain - Deleting didn't work. I attached the results off the validator but I have no idea what it means. https://www.dropbox.com/s/t6qylfwvx88xpx8/Screen%20Shot%202014-05-10%20at%202.31.40%20PM.png
 
Niraj
buzztouch Evangelist
Profile
Posts: 2943
Reg: Jul 11, 2012
Cerritos
37,930
like
05/10/14 05:13 PM (10 years ago)
Remove the last comma on that blue line.
 
Becky
I hate code!
Profile
Posts: 269
Reg: Aug 08, 2012
NYC
6,140
like
05/10/14 07:38 PM (10 years ago)
I removed the comma and the json was validated. Now the issue is when I go to run my app, I get a pop up message that says, "There was a problem reading some required data...". If I delete the plugin from the app, everything works fine. I updated and refreshed the plugin, restarted everything, cleared the cache, tried the plugin on another app with the same results…ugh. I don't know.
 
Becky
I hate code!
Profile
Posts: 269
Reg: Aug 08, 2012
NYC
6,140
like
05/10/14 07:39 PM (10 years ago)
Btw, Niraj - you Cubbyhole plugin if fantastic :)
 
Niraj
buzztouch Evangelist
Profile
Posts: 2943
Reg: Jul 11, 2012
Cerritos
37,930
like
05/11/14 09:41 AM (10 years ago)
Awesome -- Looking forward to seeing your Cubbyhole creations ... Do share! ----------------------------------------- Let's do some sleuthing! :-) Inside that plugin, look for that message of "There was a problem reading some required data". In that code block, just graze over the code. Are there any comments or code that make you go "Hmmm" or "Aha!" ? -- Niraj
 
Becky
I hate code!
Profile
Posts: 269
Reg: Aug 08, 2012
NYC
6,140
like
05/11/14 04:54 PM (10 years ago)
I will definitely share…actually - will send you a few screen shots I'm working with. Both your plugin and Atrain's and Ninja's plugins are such a blessing:) When I read your reply, I laughed. You have to know by now that every time I look at any code, it makes me go "hmmm" and "oh no!". LOL. I added the plugin again, grudgingly. Went into the control panel, saw the same message, "There was a problem reading the saved JSON data for this screen". I went to the bottom of the control panel and hit save. The message went away and now the plugin works. Atrain - it's a beautiful plugin too. Thank you! It seems like such a lame fix and in the end, that's all it was. I've seen a couple other issues as mine on this forum and for future reference, just tell them to hit save. LOL. Sounds stupid but it works.
 
ATRAIN53
Code is Art
Profile
Posts: 1755
Reg: Nov 17, 2011
Chicago
26,450
like
05/12/14 07:03 AM (10 years ago)
Good news! Thanks for the compliments. Sorry I couldn't get more involved with this yesterday, big game and a busy day. Thanks for the help Niraj- I think unless you save the JSON once it just uses the default values in the code. I think all plugins work this way to a degree- I won't get too technical but this intrigues me because I'm actually using a new technique to populate the JSON in the subclass from the Parent Screen on this plugin. I spent a few weeks working on that method and hope to use it for some additional code. It's possible that technique might require a "save" at some point to populate that data. I'll test this out on a fresh app to verify. Don't let code scare you, if you're getting this far building apps and using plugins, you're more experienced with it than you think :)
 
Niraj
buzztouch Evangelist
Profile
Posts: 2943
Reg: Jul 11, 2012
Cerritos
37,930
like
05/12/14 08:56 PM (10 years ago)
Tim -- new technique to populate the JSON -- do tell !
 
ATRAIN53
Code is Art
Profile
Posts: 1755
Reg: Nov 17, 2011
Chicago
26,450
like
05/13/14 06:56 AM (10 years ago)
check out ParentScreenData I took one of Chris tips and thru trial and error I discovered that you can populate JSON in a subclass from ParentScreenData. Here's the thread which you might recall.... https://www.buzztouch.com/forum/thread.php?tid=A90F6315C33D79CB8B9F2D7 This was the key, note the differences between these 2 lines: Chris method to access it that gave me null data- NSLog(@"\n\n\n\n\n\nparentScreen:%@", parentScreen.jsonVars); My method that gave me access to the screendata- NSLog(@"\n\n\n\n\n\nparentScreen:%@", appDelegate.rootApp.currentScreenData.jsonVars);
 

Login + Screen Name Required to Post

pointerLogin to participate so you can start earning points. Once you're logged in (and have a screen name entered in your profile), you can subscribe to topics, follow users, and start learning how to make apps like the pros.