iOS Keychain Entitlements for Using RedLaser in RubyMotion

KeychainI was recently tasked with exploring the RedLaser SDK and getting it to function in a RubyMotion application. While using a newly-created RubyMotion project I found that the function call RL_CheckReadyStatus() (which does a number of hardware and license checks) was consistently failing with a -3 return value, which represents a bad license file. Because I was experimenting with evaluation mode, which limits a device to 25 scans, and because there wasn’t a presence of a license file, this error code was erroneous on multiple levels.

After some discussion with RubyMotion support, we found that RedLaser was attempting to access the iOS keychain. The iOS keychain is used as a secure storage container, and was (most likely) being used by the RedLaser SDK for storing license information and scan counts.

To access the iOS keychain from RubyMotion, you need to request an entitlement. RubyMotion entitlements are empty by default and thus needs to be declared: