Error message: no implicit conversion of String into Integer
I have an error on verify renewable subscription.
Error message: no implicit conversion of String into Integer
E, [2016-10-13T12:15:45.470978 #2226] ERROR -- : /bundle/ruby/2.1.0/bundler/gems/venice-d2c6f2df4575/lib/venice/in_app_receipt.rb:47:in []' bundle/ruby/2.1.0/bundler/gems/venice-d2c6f2df4575/lib/venice/in_app_receipt.rb:47:ininitialize'
The second attempt was successfull
latest_receipt_info - was returned as a Hash, not an Array (https://github.com/nomad/venice/blob/master/lib/venice/client.rb#L46)
... "latest_receipt_info"=>{"original_purchase_date_pst"=>"2016-10-13 04:13:39 America/Los_Angeles", "unique_identifier" ...
Any update on this? I'm getting this error for all free trial receipts.
Seems to be if you have an iOS 6 style receipt
Is this being fixed? I have the same issue while handling subscription renewal notifications.
I have the same issue using Candy Check I came here to find a workaround but apparently this gem has the same issue as well... This is really frustrating, how did you guys handled it? @alexey-klimuk @alenia @ipranay
@hugoh1995 Did you find a solution for this?
Noo... still waiting for an update in this...
I'm seeing this issue as well when using an iOS 6 style auto-renewable subscription receipt, and here's what I think is happening. If you look at this code, you can see that it expects latest_receipt_info_attributes to be an array of hashes. In iOS 6 style receipts, latest_receipt_info_attributes is just a single hash, so the code ends up iterating over the keys in the hash, which results in InAppReceipt blowing up since the constructor expects a hash argument.
This is Apple's documentation of latest_receipt_info:
Only returned for receipts containing auto-renewable subscriptions. For iOS 6 style transaction receipts, this is the JSON representation of the receipt for the most recent renewal. For iOS 7 style app receipts, the value of this key is an array containing all in-app purchase transactions. This excludes transactions for a consumable product that have been marked as finished by your app.
What seems to fix this for me is adding the following line after the if:
latest_receipt_info_attributes = [latest_receipt_info_attributes] if latest_receipt_info_attributes.is_a?(Hash)
I'm not sure yet if there is any reason not to do this. It fixed the issue in my case at least.
I am, however, seeing other issues. For example, InAppReceipt expects an attribute called expires_date_ms, while my receipt call this field expires_date. I'm not sure what's going on there as I couldn't find expires_date_ms in Apple's documentation of receipt fields.