Discussion Forums  >  Plugins, Customizing, Source Code

Replies: 15    Views: 87

allandriggers
Apple Fan
Profile
Posts: 188
Reg: Dec 13, 2012
Knoxville, TN
11,680
07/21/13 12:24 PM (12 years ago)

Adding a custom class to BT xcode download

I finally got my payment calculator to work on its on thanks to a lot of help from the bt community. Thanks. Now I want to add it to my app I created in BuzzTouch. I know that I have to create a new class and build it. But what else do I need to do to get it to work. I want to create a link to it from my current menu. How would I do that?
 
chris1
Code is Art
Profile
Posts: 3862
Reg: Aug 10, 2012
Austin, TX
50,120
like
07/21/13 04:30 PM (12 years ago)
Really easy, actually. Add the .h and .m files to your project, and make sure you have the JSON Snippet Keeper plugin installed on your control panel. Add a JSON Snippet Keeper screen to your app, and replace the text in the box with this: {"itemId":"YOURIDHERE", "itemType":"nameOfClass"} For the "itemId" property, the JSON Snippet Keeper screen will tell you what to enter in the wording above. It will look something like: This screen's itemId is CED60DE79301DE6A6F03479 {"itemId":"CED60DE79301DE6A6F03479"} For the "itemType" property, enter the name of your .m file, without the extension. So, if you created calculator.h and calculator.m, you would enter: "itemType":"calculator" Hope this helps
 
allandriggers
Apple Fan
Profile
Posts: 188
Reg: Dec 13, 2012
Knoxville, TN
11,680
like
07/21/13 04:48 PM (12 years ago)
Cool. Thanks Chris!
 
allandriggers
Apple Fan
Profile
Posts: 188
Reg: Dec 13, 2012
Knoxville, TN
11,680
like
07/24/13 07:59 PM (12 years ago)
Hey Chris Ok I got that. I'm not quite sure how to set it up where the user can click on a menu cell and open up the payment calculator. How do I get the menu cell to point to the new payment calculator class I created?
 
chris1
Code is Art
Profile
Posts: 3862
Reg: Aug 10, 2012
Austin, TX
50,120
like
07/24/13 08:23 PM (12 years ago)
So when you setup the menu item, you should point it to the JSON Snippet Keeper screen. That's why it's important to use the itemId that the JSON Snippet Keeper tells you in the description above.
 
allandriggers
Apple Fan
Profile
Posts: 188
Reg: Dec 13, 2012
Knoxville, TN
11,680
like
07/24/13 08:32 PM (12 years ago)
ok......now I'm getting this error when i point to the snippet keeper: The plugin does not contain a category The plugin does not contain a displayAs value The plugin does not contain a loadClassOrActionName value The plugin does not contain any defaultJsonVars values There was a problem creating a screen with this plugin type.
 
chris1
Code is Art
Profile
Posts: 3862
Reg: Aug 10, 2012
Austin, TX
50,120
like
07/24/13 09:12 PM (12 years ago)
Looks like you are trying to create a new JSON Snippet Keeper screen from the menu screen. Create the JSON Snippet Keeper screen from the main "screens" tab of your control panel (I think you already did this), and then "select" this screen on the menu screen's control panel page. (keep the drop-down on the option for selecting an existing screen)
 
allandriggers
Apple Fan
Profile
Posts: 188
Reg: Dec 13, 2012
Knoxville, TN
11,680
like
07/25/13 11:49 AM (12 years ago)
Sorry to keep bothering you Chris. I did everything you told me to do. I rebuilt the payment calculator inside my main app. I put the files inside the BT_Layout folder just to stay organized. Everything compiles correctly when I run it in the sim. I go through the menu items and everything works till I get to the menu item for the snippet keeper. When I click on it, xcode opens up main.m and highlights this line in green: int retVal= UIApplicationMain(argc,argv,@"UIApplication",@"vehiclebuyingcoach_appDelegate"); There is a little green arrow point to it that says: Thread 1:signal SIGABRT I must be missing something here and its probably simple, just cant figure it out. Any Idea? Allan
 
mtcoleman9
Aspiring developer
Profile
Posts: 29
Reg: Apr 11, 2013
San Diego
2,290
like
08/26/13 06:02 PM (12 years ago)
Hi Chris/Allan, I'm following along here and I ran into the same issue. Just wondering if either of you might have worked this out? I'm going to do some digging and I'll post the solution if I find it. Thanks, Mike
 
mtcoleman9
Aspiring developer
Profile
Posts: 29
Reg: Apr 11, 2013
San Diego
2,290
like
08/26/13 06:17 PM (12 years ago)
Just noticed this on the JSON Plugin screen...I did not do this, so maybe if you're using self-hosted it could be the problem too: Self Hosted buzztouch Control Panels require a modifcation to make this plugin work. If you're self hosting buzztouch and need to use this plugin on your self hosted panel you need to replace a file in your install. Overwrite the BT-server/api/app/index.php file on your server with this file. Save this download with a .PHP extention and upload it to your server, overwriting the existing BT-server/api/app/index.php file.
 
allandriggers
Apple Fan
Profile
Posts: 188
Reg: Dec 13, 2012
Knoxville, TN
11,680
like
08/26/13 06:33 PM (12 years ago)
Hi mtcolman9 What I finally ended up doing was building my app from scratch. I just got it submitted to the app store last night. My problem seemed to be with the connections from my xib file and the class files/json snippet keeper. I might have had my IBOutlet / Delegate connections reversed? Or doubled. I don't know. But building from scratch solved everything for me Allan
 
chris1
Code is Art
Profile
Posts: 3862
Reg: Aug 10, 2012
Austin, TX
50,120
like
08/26/13 11:06 PM (12 years ago)
Shouldn't have to do anything to your self-hosted to get the JSON Snippet Keeper to work - that was probably old instructions you found. If you're getting the SIGABRT error, read my how-to on debugging XCode.
 
mtcoleman9
Aspiring developer
Profile
Posts: 29
Reg: Apr 11, 2013
San Diego
2,290
like
08/27/13 06:32 PM (12 years ago)
Thanks Chris...gave it a shot and unfortunately couldn't find anything intelligible using the debug tool. This is my first attempt at incorporating a custom class, so it would be helpful for me to even understand if the issue is with BT recognizing the class properly, or something wrong with the class itself. My console data leads me to believe that it is to do with BuzzTouch recognizing the class. If you don't mind taking a quick look, my console data is below and here is an XCode screenshot: http://screencast.com/t/AiKmCF54 2013-08-27 18:26:08.617 comeonpaypal[2279:c07] BT_screen_menuListSimple: didSelectRowAtIndexPath: Selected Row: 0 2013-08-27 18:26:08.618 comeonpaypal[2279:c07] BT_application: getScreenDataByItemId ABDECB8FB367BEEDF801FF5 2013-08-27 18:26:08.618 comeonpaypal[2279:c07] BT_application: screenType is PayPalScreen for screen with nickname: "no nickname?" and itemId: ABDECB8FB367BEEDF801FF5 2013-08-27 18:26:08.618 comeonpaypal[2279:c07] BT_viewControllerManager: handleTapToLoadScreen 2013-08-27 18:26:08.619 comeonpaypal[2279:c07] BT_viewControllerManager: the parent screen nickname: "Menu" itemId: BF3692D2FB23614B6A73C2A itemType: BT_screen_menuListSimple 2013-08-27 18:26:08.619 comeonpaypal[2279:c07] BT_viewControllerManager: the menu/button tapped is itemId: 51A12E6609995D8F2619F8E 2013-08-27 18:26:08.619 comeonpaypal[2279:c07] BT_viewControllerManager: the screen to load is nickname: "" itemId: ABDECB8FB367BEEDF801FF5 itemType: PayPalScreen 2013-08-27 18:26:08.620 comeonpaypal[2279:c07] BT_viewControllerManager: initViewControllerForScreen nickname: "no nickname?" itemId: ABDECB8FB367BEEDF801FF5 type: PayPalScreen 2013-08-27 18:26:08.620 comeonpaypal[2279:c07] -[PayPalScreen initWithScreenData:]: unrecognized selector sent to instance 0xc8b8760 2013-08-27 18:26:08.621 comeonpaypal[2279:c07] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[PayPalScreen initWithScreenData:]: unrecognized selector sent to instance 0xc8b8760' *** First throw call stack: (0x3f5c012 0x3a51e7e 0x3fe74bd 0x3f4bbbc 0x3f4b94e 0xe269 0x115c7 0x8724b 0x21c8285 0x21c84ed 0x1ccc5b3 0x3f1b376 0x3f1ae06 0x3f02a82 0x3f01f44 0x3f01e1b 0x45897e3 0x4589668 0x2118ffc 0x4a866 0x2a95 0x1) libc++abi.dylib: terminate called throwing an exception (lldb)
 
chris1
Code is Art
Profile
Posts: 3862
Reg: Aug 10, 2012
Austin, TX
50,120
like
08/28/13 07:00 PM (12 years ago)
Hmm - can you post your BT_config.txt file? (Or email it to me if it's sensitive)
 
mtcoleman9
Aspiring developer
Profile
Posts: 29
Reg: Apr 11, 2013
San Diego
2,290
like
08/30/13 01:12 PM (12 years ago)
Here it is, thanks Chris! ...just a menu and a JSON screen. {"BT_appConfig": { "BT_items":[ {"itemId":"EAF662AEC592DEC012B41EBCA", "itemType":"BT_app", "buzztouchAppId":"EAF662AEC592DEC012B41EBCA", "buzztouchAPIKey":"C3DCC9AD19579C3BE245A7A", "dataURL":"http://builder.theappcode.com/api/app/?command=getAppData&appGuid=EAF662AEC592DEC012B41EBCA&apiKey=C3DCC9AD19579C3BE245A7A&apiSecret=AB7C3954000B43AB96DEAD0", "reportToCloudURL":"http://builder.theappcode.com/api/app/?command=reportToCloud&appGuid=EAF662AEC592DEC012B41EBCA&apiKey=C3DCC9AD19579C3BE245A7A&apiSecret=AB7C3954000B43AB96DEAD0&deviceId=[deviceId]&deviceLatitude=[deviceLatitude]&deviceLongitude=[deviceLongitude]&deviceModel=[deviceModel]&userId=[userId]", "registerForPushURL":"http://builder.theappcode.com/api/app/?command=registerForPush&appGuid=EAF662AEC592DEC012B41EBCA&apiKey=C3DCC9AD19579C3BE245A7A&apiSecret=AB7C3954000B43AB96DEAD0&deviceId=[deviceId]&deviceLatitude=[deviceLatitude]&deviceLongitude=[deviceLongitude]&deviceModel=[deviceModel]&userId=[userId]", "lastModified":"Tue, 27 Aug 2013 00:10:22 -0700", "lastPublished":"Mon, 26 Aug 2013 23:56:05 -0700", "name":"ComeOnPayPal", "version":"1.0", "currentMode":"Design", "startLocationUpdates":"0", "promptForPushNotifications":"0", "allowRotation":"largeDevicesOnly", "BT_themes":[ {"itemId":"A8E2233CBBFFFA5C6FB4C3A", "itemType":"BT_theme", "backgroundColor":"#FFFFFF"} ], "BT_tabs":[ ], "BT_screens":[ {"itemId":"BF3692D2FB23614B6A73C2A", "itemType":"BT_screen_menuListSimple", "itemNickname":"Menu", "navBarTitleText":"Menu", "childItems":[ {"itemId":"51A12E6609995D8F2619F8E", "itemType":"BT_menuItem", "loadScreenWithItemId":"ABDECB8FB367BEEDF801FF5","titleText":"PaypalMobile" } ]}, {"navBarTitleText":"PaypalMobile"} ] } ] }}
 
chris1
Code is Art
Profile
Posts: 3862
Reg: Aug 10, 2012
Austin, TX
50,120
like
08/30/13 01:20 PM (12 years ago)
Ah - you haven't actually added JSON for the new screen to the BT_config.txt file. Not sure why - it should automatically add it when you save the JSON Snippet Keeper screen. Open the JSON Snippet Keeper screen up on your control panel and make sure it look sright and hit save again. Then use the "Publish Changes" feature.
 

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.