infinitered / ProMotion-iap

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

Restore purchase bug #5

Closed erohin closed 8 years ago

erohin commented 9 years ago

When i try to restore purchase:

13  StoreKit                        0x2c011010 -[SKPaymentQueue _notifyObserversAboutChanges:sendUpdatedDownloads:] + 124
14  StoreKit                        0x2c011922 -[SKPaymentQueue _processUpdates:trimUnmatched:sendUpdatedDownloads:] + 1070
15  StoreKit                        0x2c012252 -[SKPaymentQueue _updatePaymentsForMessage:] + 118
16  StoreKit                        0x2c010f2a __44-[SKPaymentQueue _handleMessage:connection:]_block_invoke + 138

If i try to bye same inapp after cancel restore it (i can cancel restore purchase if i'm not login on device), i get this

product.rb:23:in `block in restore': undefined method `find' for #<SKPaymentTransaction:0x12b13170> (NoMethodError)
kevinvangelder commented 9 years ago

@erohin Thanks for the bug report. Our testing abilities are very limited because Apple won't allow IAP transactions from the iOS simulator. Can you tell me if you were using the IAP Module or the Product Class?

erohin commented 9 years ago

Hi @kevinvangelder, i get error in this code:

full_version = PM::IAP::Product.new('MyApp.NonConsumable.FullVersion')
full_version.retrieve do |inapp, error|
  if inapp
    view.find(:unlock).find(:button).off.on(:touch) do
      full_version.purchase do |status, transaction|
        case status
          when :in_progress
          when :deferred
          when :purchased
            App.alert('Unlocked')
            NSUserDefaults[:full_version] = true
          when :canceled
          when :error
            mp transaction.error.localizedDescription
        end
      end
    end
    view.find(:restore).off.on(:touch) do
      full_version.restore do |status, product|
        if status == :restored
          App.alert('Unlocked')
          NSUserDefaults[:full_version] = true
        else
          App.alert('Fail')
        end
      end
    end
    if error
      mp error
    end
  end
end

I get error only when i try to restore purchase. Now i use rm_vendor gem, without this error. rm_vendor restore method:

def restore(params, &block)
  @params = params
  @block = block
  SKPaymentQueue.defaultQueue.restoreCompletedTransactions
end

ProMotion-iap have same realization. I can't tell you where is the problem :(

jamonholmgren commented 9 years ago

@erohin, we're working on this -- back with you soon!