infinitered / ProMotion-iap

In-app purchases for ProMotion!
19 stars 7 forks source link

Hangs or crashes app if iTunes endpoints are down #15

Open dam13n opened 9 years ago

dam13n commented 9 years ago

I was testing purchasing in my app in the simulator and on device, and it suddenly stopped working. Noticed if I tried to hit the iTunes receipt endpoint (503 error) or access iTunes Connect, they weren't responding. It was temporary and not sure how frequent this is, but could be good to catch.

jamonholmgren commented 9 years ago

Yeah, good idea.

Was simulator working for IAP?

dam13n commented 9 years ago

Pretty sure the simulator had the same issue, but it didn't crash the app like on the device. A couple of those times I got an error at line 156 of iap.rb because .code was called on nil. I forked the repo to play with things but ran into #16 .

if transaction.error.code == SKErrorPaymentCancelled
  iap_callback(:canceled, transaction, true)
else
dam13n commented 9 years ago

Sooo, I think it's the error in the previous comment that actually crashed the device. The iTunes outage may been coincidental timing (but I still think caused its own problem).

<Error>: *** Terminating app due to uncaught exception 'NoMethodError', reason: 'event.rb:124:in `block in paymentQueue:updatedTransactions:': undefined method `code' for nil:NilClass (NoMethodError)

Now I'm catching the error, and app purchasing on the device is working fine so far. Not sure why this doesn't surface on the simulator.

This comes up too:

iap.rb:146:in `request:didFailWithError:': undefined method `arity' for nil:NilClass (NoMethodError)
2015-10-12 17:43:03.277 muskotage-ios[96739:6798923] *** Terminating app due to uncaught exception 'NoMethodError', reason: 'iap.rb:146:in `request:didFailWithError:': undefined method `arity' for nil:NilClass (NoMethodError)