googlesamples / ios-nearby

68 stars 30 forks source link

NearbyMessages 1.1.0 crash #22

Open oleg-srost opened 7 years ago

oleg-srost commented 7 years ago

Hello! We are going to update NearbyMessages from 1.0.1 to 1.1.0 to include your latest fixes espessially "Fixed an audio crash.". In version 1.0.1 our app crashes (not always) when we set to nil all GNSPublications and GNSSubscriptions. After upgrade to 1.1.0 app crashes every time when we are going to use nearby messages.

I've created a sample project https://bitbucket.org/olegvishSS/nearbymessagestestapp. It has branches "version_101" and "version_110" (numbers correspond to NearbyMessages version used in it) When we start app and press "Allow" to use nearby in 101 - nothing happens, but in 110 - app crashes in a few moments after.

In test app mentioned above there is NearbyManager.swift file. It has method start(). Methods deviceMessageSubscriptionSetup() and cardMessageSubscriptionSetup() are called inside start(). If I call one of these methods or both of them app crashes with EXC_BAD_ACCESS in a few moments later. If app firstly installed when we call deviceMessageSubscriptionSetup() and/or cardMessageSubscriptionSetup() methods user see alert "Allow app to use Nearby". App crashes when allow button pressed.

Thank you in advance for your answer.

dan-webb commented 7 years ago

Hello,

Thanks for the very helpful sample app! I downloaded version_110 and reproduced the crash. The crash is caused by a missing NSMicrophoneUsageDescription entry in the Info.plist file. This entry used to be optional, but Apple made it mandatory in iOS 10. If you look in the console (when running the app on a device, not the simulator), you'll see an error message about the missing NSMicrophoneUsageDescription.

I was curious as to why it wouldn't crash in version_101, so I downloaded it, erased the previous version of the test app from my device, and ran it. It also crashed.

Let me know if adding the NSMicrophoneUsageDescription entry fixes the problem. I'm happy to hear that upgrading to v1.1.0 fixed the audio crash.

Thanks for the bug report! Again, let me know if you have any more problems.