Discussion Forums  >  Plugins, Customizing, Source Code

Replies: 14    Views: 87

eespverbatim
buzztouch Evangelist
Profile
Posts: 106
Reg: Feb 14, 2012
London
5,160
02/25/14 05:57 AM (10 years ago)

Duplicating Xib Buttons Menu

Hi All, I've been working with the Xib Button Menu plug in, which I think is really great, really opens up the possibilities, but I have run into a problem and could use some hints. I want to have several xib menus in my app, and I followed the instructions on the control panel about duplicating the menu; the result, however, was an apocalypse of error and fail. Here's what I did. 1. Duplicated JM_Xib_button_menu.xib and JM_Xib_button_menu~ipad.xib in the same directory in my project bundle on my HD and re-named. 2. Dragged renamed xib files into XCode 3. Set-up new Xib Buttons Menu in BT Control Panel, set file name property to new, re-named JM_Xib_button_menu.xib 4. Ran on sim and got generic 'plug in not found' message - BTW, original xib menu working fine. 5. Thought that perhaps I overlooked duplicating JM_Xib_button_menu.h & JM_Xib_button_menu.m. Did so, re-naming to match duplicated .xib, dragged to xcode 6. Ran on sim, got a critical fail. Any help much appreciated, as always.
 
MadRod
Aspiring developer
Profile
Posts: 1853
Reg: Apr 12, 2012
Lisbon
27,930
like
02/25/14 06:57 AM (10 years ago)
Hi, I'd say that you don't need to duplicate the .m and .h files. Just need new xib files. Lets say you have new xib files named: JM_Xib_button_menu_2.xib JM_Xib_button_menu_2~ipad.xib In the filename property you'd add: JM_Xib_button_menu_2.xib Is this what you've done? What errors do you get on Xcode? Cheers, Miguel
 
eespverbatim
buzztouch Evangelist
Profile
Posts: 106
Reg: Feb 14, 2012
London
5,160
like
02/25/14 08:24 AM (10 years ago)
That's what I did the first time. I get a crash and the highlighted error: int retVal = UIApplicationMain(argc, argv, @"UIApplication", @"testapp_appDelegate"); with thread1 signal SIGABRT next to it and the final event in the output: UIApplicationMain + 1225 29 testapp 0x0005ac56 main + 86 30 libdyld.dylib 0x0669e70d start + 1 ) libc++abi.dylib: terminating with uncaught exception of type NSException (lldb)
 
ATRAIN53
Code is Art
Profile
Posts: 1755
Reg: Nov 17, 2011
Chicago
26,450
like
02/25/14 10:45 AM (10 years ago)
I don't have that plugin but a couple of things- The true "magic" of BT is that you can use the same ViewController over and over again in a project. They become 'screens' when you feed JSON into the plugin code thru the control panel. Your BT_Config file is what calls the screens and populates them with JSON, this is why each screen gets a uniqe id, so it knows where to feed the JSON. But it's still the SAME viewcontroller. The only reason to duplicate that plugin (or any other plugin) is if you want to use it in the same project but as a "modded" version. Say for instance you want one of those XIB menu screens with round buttons and one of them with square buttons. To duplicate a plugin you must duplicate the entire plugin package. 1) Copy the folder and append a letter to the end of the class names - even the XIB files, they MUST match the class name or they won't load. 2) Update the config.txt file and change the loadClassOrActionName accordingly. Now upload that to your server and you'll have a new version of the same plugin :) tip: practice by duplicating a simple plugin like the BT_ScreenBlank make a BT_ScreenBlankA plugin and you'll get the idea.....
 
chris1
Code is Art
Profile
Posts: 3862
Reg: Aug 10, 2012
Austin, TX
50,120
like
02/25/14 11:02 AM (10 years ago)
MadRod is correct that you don't need to duplicate the .h or .m files - only the .xib files. The error you got isn't entirely helpful, though, as it basically just says the app crashed. (Duh!) :) Can you paste the debug output from Xcode when the crash occurred?
 
eespverbatim
buzztouch Evangelist
Profile
Posts: 106
Reg: Feb 14, 2012
London
5,160
like
02/25/14 11:29 AM (10 years ago)
Hi Chris, Thanks. So the app initially loads Xib Buttons "Main Menu", the second button links to a duplicated xib menu nicknamed 'Sounding'. Loading is fine, tapping to launch 'sounding' crashes it. Here's the skinny: supportedInterfaceOrientationsForWindow 2014-02-25 15:54:06.351 testapp[5952:70b] JM_Xib_button_menu: viewDidLoad 2014-02-25 15:54:06.351 testapp[5952:70b] JM_Xib_button_menu: viewDidLoad (super) 2014-02-25 15:54:06.351 testapp[5952:70b] JM_Xib_button_menu: viewWillAppear (super) 2014-02-25 15:54:06.352 testapp[5952:70b] JM_Xib_button_menu: configureNavBar (super) for screen with itemId: 6655A67DA263F3B20629B99 2014-02-25 15:54:06.352 testapp[5952:70b] BT_viewUtilities: getNavBarBackgroundColorForScreen: Screen "Main Menu" color: clear 2014-02-25 15:54:06.353 testapp[5952:70b] JM_Xib_button_menu: configureBackground (super) for screen with itemId 6655A67DA263F3B20629B99: 2014-02-25 15:54:06.353 testapp[5952:70b] BT_background_view: updateProperties (color and image) for screen with itemId: 6655A67DA263F3B20629B99: 2014-02-25 15:54:06.354 testapp[5952:70b] BT_fileManager: File does exist in Xcode bundle: "testappBackPhone5.png" 2014-02-25 15:54:06.354 testapp[5952:70b] BT_background_view: "testappBackPhone5.png" exists in Xcode bundle - not downloading. 2014-02-25 15:54:06.354 testapp[5952:70b] BT_background_view: setImage 2014-02-25 15:54:06.355 testapp[5952:70b] JM_Xib_button_menu: viewWillAppear 2014-02-25 15:54:06.355 testapp[5952:70b] testapp_appDelegate: supportedInterfaceOrientationsForWindow 2014-02-25 15:54:06.357 testapp[5952:70b] testapp_appDelegate: supportedInterfaceOrientationsForWindow 2014-02-25 15:54:06.357 testapp[5952:70b] testapp_appDelegate: supportedInterfaceOrientationsForWindow 2014-02-25 15:54:06.357 testapp[5952:70b] testapp_appDelegate: supportedInterfaceOrientationsForWindow 2014-02-25 15:54:08.570 testapp[5952:70b] JM_Xib_button_menu: buttonTapped: Button Tag: 2 Load screen with itemId: "D906E445393DBE2A62C5352" 2014-02-25 15:54:08.570 atestapp[5952:70b] BT_application: getScreenDataByItemId D906E445393DBE2A62C5352 2014-02-25 15:54:08.570 testapp[5952:70b] BT_application: screenType is JM_Xib_button_menu for screen with nickname: "Sounding" and itemId: D906E445393DBE2A62C5352 2014-02-25 15:54:08.571 testapp[5952:70b] JM_Xib_button_menu: handleTapToLoadScreen (super) loading nickname: "Sounding" itemId: D906E445393DBE2A62C5352 itemType: JM_Xib_button_menu 2014-02-25 15:54:08.571 testapp[5952:70b] BT_application: getViewControllerForScreen nickname: "Sounding" itemId: D906E445393DBE2A62C5352 type: JM_Xib_button_menu 2014-02-25 15:54:08.571 testapp[5952:70b] JM_Xib_button_menu: INIT 2014-02-25 15:54:08.571 testapp[5952:70b] BT_navController: pushViewController 2014-02-25 15:54:08.572 testapp[5952:70b] BT_navController: transition type: fade 2014-02-25 15:54:08.575 testapp[5952:70b] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Could not load NIB in bundle: 'NSBundle </Users/admin/Library/Application Support/iPhone Simulator/7.0.3-64/Applications/E510388F-5FEE-4162-8BB4-B08AEA04E7C4/testapp.app> (loaded)' with name 'JM_Xib_button_sounding.xib''
 
chris1
Code is Art
Profile
Posts: 3862
Reg: Aug 10, 2012
Austin, TX
50,120
like
02/25/14 01:06 PM (10 years ago)
Try this - delete the xib file from Xcode, choosing the "remove reference" option, not the "move to trash" option. Then drag the file from Finder back into Xcode.
 
eespverbatim
buzztouch Evangelist
Profile
Posts: 106
Reg: Feb 14, 2012
London
5,160
like
02/25/14 02:38 PM (10 years ago)
Thanks Chris, but same result unfortunately. Cleaned project, reset sim, removed reference and dragged in again from finder, re-synced sim with BT CP, but to no avail.
 
Red Dog
buzztouch Evangelist
Profile
Posts: 805
Reg: Jun 16, 2011
Southern Califo...
18,800
like
02/25/14 03:22 PM (10 years ago)
Might not apply but..... When you duplicate the .xib file, make sure you change the class name in your identity inspector to match the original. It will probably default to UIView.
 
MadRod
Aspiring developer
Profile
Posts: 1853
Reg: Apr 12, 2012
Lisbon
27,930
like
02/26/14 04:13 AM (10 years ago)
I decided to give it a try, and I get theses errors on my log: 2014-02-26 11:09:58.088 castelosdeportugal[2667:70b] BT_viewControllerManager: initViewControllerForScreen nickname: "Castelos." itemId: 9FBEC58363418296257FB39 type: JM_Xib_button_menu 2014-02-26 11:09:58.088 castelosdeportugal[2667:70b] +[BT_debugger showIt:message:]: unrecognized selector sent to class 0xe3ba4 2014-02-26 11:09:58.090 castelosdeportugal[2667:70b] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '+[BT_debugger showIt:message:]: unrecognized selector sent to class 0xe3ba4' *** First throw call stack: ( 0 CoreFoundation 0x04efd5e4 __exceptionPreprocess + 180 1 libobjc.A.dylib 0x039c68b6 objc_exception_throw + 44 2 CoreFoundation 0x04f9a7a3 +[NSObject(NSObject) doesNotRecognizeSelector:] + 275 3 CoreFoundation 0x04eed90b ___forwarding___ + 1019 4 CoreFoundation 0x04eed4ee _CF_forwarding_prep_0 + 14 5 castelosdeportugal 0x00096298 -[JM_Xib_button_menu initWithScreenData:] + 296 6 castelosdeportugal 0x0001f169 +[BT_viewControllerManager initViewControllerForScreen:] + 1033 7 castelosdeportugal 0x000224c7 +[BT_viewControllerManager handleTapToLoadScreen:theMenuItemData:theScreenData:] + 12295 8 castelosdeportugal 0x000af21e -[JC_LaunchScreen launchScreenNormal] + 3358 9 Foundation 0x0167312c __NSFireDelayedPerform + 372 10 CoreFoundation 0x04ebbbd6 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 22 11 CoreFoundation 0x04ebb5bd __CFRunLoopDoTimer + 1181 12 CoreFoundation 0x04ea3628 __CFRunLoopRun + 1816 13 CoreFoundation 0x04ea2ac3 CFRunLoopRunSpecific + 467 14 CoreFoundation 0x04ea28db CFRunLoopRunInMode + 123 15 GraphicsServices 0x044059e2 GSEventRunModal + 192 16 GraphicsServices 0x04405809 GSEventRun + 104 17 UIKit 0x01acfd3b UIApplicationMain + 1225 18 castelosdeportugal 0x0009a6a6 main + 134 19 libdyld.dylib 0x04b8870d start + 1 ) libc++abi.dylib: terminating with uncaught exception of type NSException (lldb) Thanks,
 
eespverbatim
buzztouch Evangelist
Profile
Posts: 106
Reg: Feb 14, 2012
London
5,160
like
02/26/14 06:16 AM (10 years ago)
Thanks MadRod - any luck in solving the issue? Chris - is menu duplication possible?
 
chris1
Code is Art
Profile
Posts: 3862
Reg: Aug 10, 2012
Austin, TX
50,120
like
02/26/14 01:57 PM (10 years ago)
So I just tried this in a quick test app. It worked great. Here's what I did: 1) Created two screens using the "XIB Button Menu" plugin on my control panel, and linked both to a menu screen. For simplicity, I used "xib1" and "xib2" for nicknames. 2) In the "xib2" settings, I set the filename property to "cr_xib2". Note: I did not include the ".xib" extension. 3) I downloaded the project, unzipped the package and loaded it into Xcode. I drug the plugins folder into Xcode as well. 4) In my Finder window, I opened the folder "/project/BT_plugins/xib_button_menu/" and selected the "JM_Xib_button_menu.xib" file. I copied and pasted it into the same folder, and renamed the copy to "cr_xib2.xib". 5) I drug the "cr_xib2.xib" file into Xcode and made a small change to that file (I deleted two of the buttons). I ran the app on the simulator and it worked great.
 
MadRod
Aspiring developer
Profile
Posts: 1853
Reg: Apr 12, 2012
Lisbon
27,930
like
02/26/14 03:53 PM (10 years ago)
Mine seemed to be a package problema. All seems ok now. Thanks.
 
eespverbatim
buzztouch Evangelist
Profile
Posts: 106
Reg: Feb 14, 2012
London
5,160
like
02/27/14 06:14 AM (10 years ago)
Nailed it! Legend Chris. For those that run into this problem in future and stumble across this thread, it seems that it's a question of getting all the ducks in a row and CRUCIALLY not including the .xib extension in your control panel filename. Variances with Chris' solution above: -I have an existing project with a fair amount of customisations in xcode, so was loath to download the project again and start clean. -When I implemented Chris' solution on my existing project, rather than his brand new one, the crashing was cleared up, but the sim displayed the generic buzztouch 'plugin not found' screen. -I trashed my duplicated xib menus, deleted them from the control panel and set up new versions in control panel, duplicated new xib files in the finder, dragged them fresh into xcode, deleted a couple of buttons here and there on the dupes. - I then entered the control panel filenames omitting the .xib extension *as a first step* before making any changes to the menus. This un-f'd the whole thing, leaving a happy man to go and get a beer.
 
chris1
Code is Art
Profile
Posts: 3862
Reg: Aug 10, 2012
Austin, TX
50,120
like
02/27/14 06:56 AM (10 years ago)
Lol - glad to hear it! Would love to see some screenshots of how people are using this
 

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.