A moaning dog

I heard a story one time of a farmer who had a dog who loved to lay on the front porch. The dog would lay there all day long and watch the farmer work. Occasionally, the dog would shift its weight around, and when doing so, it would give out a long, howling moan. When the farmer was asked why his dog does that, and does it day-in and day-out, he replied, "That's my dog's favorite spot, and he loves laying there. There's a nail sticking up out of the floor boards just enough to poke him in his belly, that's why he yells." The other person asked him the obvious question, "Wow...why doesn't he just...get off the nail?" The farmer replied, "I guess it doesn't hurt him badly enough."

I realized after uploading the MyPrayerMap for iOS binary to Apple that I neglected to fix an issue that I knew about, but it was not pressing at the times I was thinking about it, and it wasn't a "major" issue, so it frequently slipped off my radar. The issue was that after adding a prayer request via the long-press touch gesture, it would let you add one (or you could cancel), but then the opportunity would go away upon dismissing -- and it was only on the iPad.

While mowing my lawn today, the solution hit me like a ton of bricks. Why didn't I think of this before? What I was doing (for those technically inclined) was checking to see if the UILongPressGestureRecognizer object's state was in the Began state, and then it would go about it's business of calling the modal segue. If the state was Changed or Ended, it would remove it from the view, to prevent other erratic behavior (it would get re-added in viewWillAppear, which is why it worked on the iPhone and not iPad). This seemed contrived, and I thought there had to be a better way. ...and there was. UIGestureRecognizer's delegate method, -(BOOL)gestureRecognizerShouldBegin: was the key, and allowed me to check logic to either return YES or NO, and allowed me to remove the lines that removed the gesture recognizer in the Changed or Ended states.

Lesson learned: take care of those pain points when they come up, so they don't come back to bug you later. Pun intended.