Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

mms13

macrumors 6502
Original poster
Jun 29, 2010
367
75
Baltimore, MD
I'm experiencing a very weird issue with my app:

I'm going about the standard way of detecting a shake event. I have implemented the canBecomeFirstResponder method, and I call becomeFirstResponder in viewDidAppear and resignFirstResponder in viewWillDisappear. Then I implement the motionBegan method to handle the shake events.

When I build and run my application onto my device through XCode, everything works great. The motionBegan event fires and my program properly handles the shake event. All good, so I submitted my application. I was shocked to find out that when I downloaded it from the App Store, that my shake events weren't working! Now, in trying to fix this problem, I've also found that it doesn't work if I archive my app as an .ipa file and then load it onto my phone through iTunes.

In short, the shake event fires through a run on XCode, but not when it's been put onto a device via distribution methods!

This doesn't make any sense to me so I'm really hoping someone knows what's wrong!

PS - this issue occurs regardless of how application.applicationSupportsShakeToEdit is set.
 

jiminaus

macrumors 65816
Dec 16, 2010
1,449
1
Sydney
Sounds like an issue because caused by debug build verses release build. Release build turns on compiler optimisations, which can expose bugs that aren't apparent without optimisations. Which version of XCode are you using?
 

mms13

macrumors 6502
Original poster
Jun 29, 2010
367
75
Baltimore, MD
Well, I was using XCode 4.2 to build on my iOS 5 device. Then I would open the project in XCode 4.0.2 to archive/submit to iTunes Connect. Perhaps that was the issue.

But anyway, I fixed the problem by using the motionEnded() event handler as opposed to motionBegan(). Maybe motionBegan can't detect the shake event? Either way though it's weird that it works in debug but not release.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.