DiabetesCompass / Diabetes_Compass

iOS code for type 1 diabetes management
MIT License
4 stars 0 forks source link

running terminates (crash) when the Menu button pushed #3

Closed calferness closed 7 years ago

calferness commented 7 years ago

Steps to reproduce: Run app. Navigate to view showing BG Compass and two buttons at top right. Tap menu button (top right corner) App crashes.

To help debug, can set exception breakpoint all exceptions. Start app, skip over several exceptions. Then tap Menu button

In PPiFlatSegmentedControl.m addItems: withFrame: loops through items. Apparently each item should have a title and an icon. However item has only one key / value pair, {text: food}

2016-11-07 21:40:23.436 BGCompass[12061:96661] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSSingleEntryDictionaryI title]: unrecognized selector sent to instance 0x608000227f60'

beepscore commented 7 years ago

What is the "expected" (designed) appearance and behavior for these two buttons? Maybe we can fix by using simpler objects, at least for now. Maybe show text instead of an image.

"this library is no longer supported and might be broken since I haven't updated it for months." https://github.com/pepibumur/PPiFlatSegmentedControl/issues/32

HomeViewController has some commented out code to instantiate segmented. It is missing final parameter iconSeparation

PPiFlatSegmentedControl *segmented=[[PPiFlatSegmentedControl alloc]
                                initWithFrame:CGRectMake(-2, 64.5, 323, 39.5)
                                items:@[@{@"text":@"Food"},@{@"text":@"Glucose"}, @{@"text":@"Insulin"}]
                                iconPosition:IconPositionRight
                                andSelectionBlock:^(NSUInteger segmentIndex) {

self.selectedSegmentIndex = segmentIndex;
[self performSegueWithIdentifier:@"ItemListViewSegue" sender:self];
}];
}
                               iconSeparation: 0];

I temporarily uncommented the code and adjusted it, app still crashed. Didn't commit.

calferness commented 7 years ago

Ah, interesting. When that particular button is pushed, it normally segues to a scene with 4 buttons on top labeled in text. They say " glucose, food, insulin, & all". When one of those 4 is pushed, it bring up a tableview with an array of historical data of that particular data set. The"all" one collates them by datestamp. From these scenes, data can be added from a button in the navigation bar or copied, or edited by clicking on an item in the array. The storyboard is very confusing to me, but so is most all of it. I have a hard time figuring out the segues from it. C Sent from my iPhone

On Nov 7, 2016, at 10:17 PM, Steve Baker notifications@github.com wrote:

What is the "expected" (designed) appearance and behavior for these two buttons? Maybe we can fix by using simpler objects, at least for now. Maybe show text instead of an image.

"this library is no longer supported and might be broken since I haven't updated it for months." pepibumur/PPiFlatSegmentedControl#32

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

beepscore commented 7 years ago

git commit #d644c97 Fix immediate crash if user taps Compass scene / HomeViewController menu button to MenuSegue to menu view. In MenuViewController change items array elements from type NSDictionary to PPiFlatSegmentItem. TODO: Replace placeholder icon images with desired images.

beepscore commented 7 years ago

Currently MenuViewController shows a PPiFlatSegmentedControl with 4 buttons. Text isn't showing at the moment.

Should the HomeViewController ever show a PPiFlatSegmentedControl? If not we can delete commented out code for segmented at end of viewDidLoad.

calferness commented 7 years ago

I don't see any reason for it. Maybe that was just used to show icons? Should be able to use image icons with stock buttons? Likewise maybe the MenuViewController should just use the stock segmented control with momentary switches. It just has text on them anyway. It seems they made some of this more complicated than was needed, but perhaps iOS didn't have the same capability back then.

Sent from my iPhone

On Nov 8, 2016, at 10:53 PM, Steve Baker notifications@github.com wrote:

Currently MenuViewController shows a PPiFlatSegmentedControl with 4 buttons. Text isn't showing at the moment.

Should the HomeViewController ever show a PPiFlatSegmentedControl? If not we can delete commented out code for segmented at end of viewDidLoad.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

beepscore commented 7 years ago

Fixed crash. If post-button-tap behavior is incorrect, please create a new issue.