The Firebase API have conflict with the IOS IAP delegate

758 views
Skip to first unread message

mengmeng

unread,
Nov 8, 2016, 8:18:48 AM11/8/16
to Firebase Google Group
Could you please help to look on this case? This is about the Firebase API have conflict with the IOS API delegate. Developer found out that :

1. When the user didn't finish the transaction on one item (= not call the IOS API: finishTransaction), next time, when the user want to purchase the item or another, the purchase system cannot implement.

2. On the normal case without using Firebase SDK, Apple will record the unfinished transaction, to let the user re-enter the purchase interface (by adding Apple's addTransactionObserver, Apple's agent will call the updatedTransactions). However, after using the Firebase SDK, updatedTransactions cannot be called.

Kato Richardson

unread,
Nov 8, 2016, 12:05:54 PM11/8/16
to Firebase Google Group
We're going to need version info, minimal steps to reproduce, sample data, complete error messages, and probably a lot of screenshots and guidance on verifying this behavior before we can be any help here. Always include a minimal, complete, verifiable example of the problem.

☼, Kato

--
You received this message because you are subscribed to the Google Groups "Firebase Google Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to firebase-talk+unsubscribe@googlegroups.com.
To post to this group, send email to fireba...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/firebase-talk/4d247e3f-0f54-4563-a11e-5aac32372c7d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--

Kato Richardson | Developer Programs Eng | kato...@google.com | 775-235-8398

MengMeng

unread,
Nov 9, 2016, 9:54:21 AM11/9/16
to fireba...@googlegroups.com
It doesn't matter with ios version, device model and any others.
Let me clarify the issue and give the reproduce process.

The normal in-app-purchase process is good to work. Now we add firebase SDK to app, we only add this code: [FIRApp configure], then the problem will happen. If I hide this code (use double slash), then it won't happen. 
The problem only happened when the user doesn't want to finish the purcahse process (= not call the Apple API: finishTransaction).

Here is the process that how the problem reproduce :
1. We add the purchase feature on the app interface, and when we done the purchase, we don't call the API:finishTransaction.
2. Then, when we would like to buy the item which is we just baught but didn't finish the final confirmation, Apple will pop-up the alert "you have ever purchased this in-app item, this item will be recoverd to be free.”
3. Afetr the alert, below two function don't be called. Under the normal situation that, below two function should be called : 

- (void)paymentQueue:(SKPaymentQueue *)queue updatedTransactions:(NSArray<SKPaymentTransaction *> *)transactions
- (void)paymentQueue:(SKPaymentQueue *)queue removedTransactions:(NSArray<SKPaymentTransaction *> *)transactions

We guess that, the firebase SDK is monitoring the App In-app-purchase, or when the "Observe code" of the firebase is being excuted, then the "Observe code" of us cannot get the inform. 

Any help will be appreciated.

Kato Richardson

unread,
Nov 15, 2016, 3:32:12 PM11/15/16
to Firebase Google Group
To be any help troubleshooting, I'll need a minimal, complete, verifiable example of the problem. Specifically, it seems like you might be adding the transaction observers in an odd way, so we'd want to be able to look at that code, as well as where you're adding [FIRApp configure].

☼, Kato

On Wed, Nov 9, 2016 at 12:24 AM, MengMeng <b.yum...@gmail.com> wrote:
It doesn't matter with ios version, device model and any others.
Let me clarify the issue and give the reproduce process.

The normal in-app-purchase process is good to work. Now we add firebase SDK to app, we only add this code: [FIRApp configure], then the problem will happen. If I hide this code (use double slash), then it won't happen. 
The problem only happened when the user doesn't want to finish the purcahse process (= not call the Apple API: finishTransaction).

Here is the process that how the problem reproduce :
1. We add the purchase feature on the app interface, and when we done the purchase, we don't call the API:finishTransaction.
2. Then, when we would like to buy the item which is we just baught but didn't finish the final confirmation, Apple will pop-up the alert "you have ever purchased this in-app item, this item will be recoverd to be free.”
3. Afetr the alert, below two function don't be called. Under the normal situation that, below two function should be called : 

- (void)paymentQueue:(SKPaymentQueue *)queue updatedTransactions:(NSArray<SKPaymentTransaction *> *)transactions
- (void)paymentQueue:(SKPaymentQueue *)queue removedTransactions:(NSArray<SKPaymentTransaction *> *)transactions

We guess that, the firebase SDK is monitoring the App In-app-purchase, or when the "Observe code" of the firebase is being excuted, then the "Observe code" of us cannot get the inform. 

Any help will be appreciated.

For more options, visit https://groups.google.com/d/optout.

hoshin...@gmail.com

unread,
Jan 27, 2017, 1:05:38 AM1/27/17
to Firebase Google Group

Hello Kato,


It seems that this issue also occurs in my local environment.

I've confirmed that the problem takes place in SDK for iOS and SDK for Unity.

(I personally use SDK for Unity, so I would like it if you could fix not only the SDK for iOS but also the SDK for Unity)


▼ Steps to Reproduce

  1. Download the project from below
    1. https://github.com/firebase/quickstart-ios/tree/master/analytics
  2. In-able for the Firebase to work, add GoogleService-Info.plist
  3. Add purchase process to AppDelegate.m
  4. Start the application and make a purchase to leave an incomplete Transaction
    1. (make a purchase Transaction but don't call finishTransaction on that)
  5. Call the addTransactionObserver after the [FIRApp configure], and start the application
    1. ⇛ updatedTransactions that should be called after addTransactionObserver cannot be called

※Please refer to the attached file for changes that should be applied on AppDelegate.m


▼ Additional Information

  • To wait for the Firebase Analytics to finish it's initialization, I am using afterDelay to delay the timing of the addTransactionObserver
  • afterDelay is not required
    • After the Firebase Analytics to finish it's initialization, you can just perform the addTransactionObserver to reproduce it
  • updatedTransactions can be called after addPayment but it's kind of strange that it cannot be called after addTransactionObserver, and I think this is a critical problem.


Thanks


2016年11月16日水曜日 5時32分12秒 UTC+9 Kato Richardson:
To be any help troubleshooting, I'll need a minimal, complete, verifiable example of the problem. Specifically, it seems like you might be adding the transaction observers in an odd way, so we'd want to be able to look at that code, as well as where you're adding [FIRApp configure].

☼, Kato
On Wed, Nov 9, 2016 at 12:24 AM, MengMeng <b.yum...@gmail.com> wrote:
It doesn't matter with ios version, device model and any others.
Let me clarify the issue and give the reproduce process.

The normal in-app-purchase process is good to work. Now we add firebase SDK to app, we only add this code: [FIRApp configure], then the problem will happen. If I hide this code (use double slash), then it won't happen. 
The problem only happened when the user doesn't want to finish the purcahse process (= not call the Apple API: finishTransaction).

Here is the process that how the problem reproduce :
1. We add the purchase feature on the app interface, and when we done the purchase, we don't call the API:finishTransaction.
2. Then, when we would like to buy the item which is we just baught but didn't finish the final confirmation, Apple will pop-up the alert "you have ever purchased this in-app item, this item will be recoverd to be free.”
3. Afetr the alert, below two function don't be called. Under the normal situation that, below two function should be called : 

- (void)paymentQueue:(SKPaymentQueue *)queue updatedTransactions:(NSArray<SKPaymentTransaction *> *)transactions
- (void)paymentQueue:(SKPaymentQueue *)queue removedTransactions:(NSArray<SKPaymentTransaction *> *)transactions

We guess that, the firebase SDK is monitoring the App In-app-purchase, or when the "Observe code" of the firebase is being excuted, then the "Observe code" of us cannot get the inform. 

Any help will be appreciated.
2016-11-09 2:05 GMT+09:00 'Kato Richardson' via Firebase Google Group <fireba...@googlegroups.com>:
We're going to need version info, minimal steps to reproduce, sample data, complete error messages, and probably a lot of screenshots and guidance on verifying this behavior before we can be any help here. Always include a minimal, complete, verifiable example of the problem.

☼, Kato
On Tue, Nov 8, 2016 at 2:39 AM, mengmeng <b.yum...@gmail.com> wrote:
Could you please help to look on this case? This is about the Firebase API have conflict with the IOS API delegate. Developer found out that :

1. When the user didn't finish the transaction on one item (= not call the IOS API: finishTransaction), next time, when the user want to purchase the item or another, the purchase system cannot implement.

2. On the normal case without using Firebase SDK, Apple will record the unfinished transaction, to let the user re-enter the purchase interface (by adding Apple's addTransactionObserver, Apple's agent will call the updatedTransactions). However, after using the Firebase SDK, updatedTransactions cannot be called.

--
You received this message because you are subscribed to the Google Groups "Firebase Google Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to firebase-tal...@googlegroups.com.

To post to this group, send email to fireba...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/firebase-talk/4d247e3f-0f54-4563-a11e-5aac32372c7d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--

Kato Richardson | Developer Programs Eng | kato...@google.com | 775-235-8398

--
You received this message because you are subscribed to the Google Groups "Firebase Google Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to firebase-tal...@googlegroups.com.

To post to this group, send email to fireba...@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "Firebase Google Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to firebase-tal...@googlegroups.com.

To post to this group, send email to fireba...@googlegroups.com.
AppDelegate.m

Stewart Miles

unread,
Jan 30, 2017, 5:43:12 PM1/30/17
to fireba...@googlegroups.com
Hi I'm one of our Firebase C++ / Unity engineers,

From one of our iOS engineers:

"The issue happens because as soon as the very first transaction observer is added, the callbacks for unfinished transactions occur. Since initializing Firebase adds our own transaction observer, that triggers the callbacks, and if the developer's own observers have not yet been added, then the developer will miss receiving those callbacks as they do not repeat"

With that in mind, does this work if you add the transaction observer before [FIRApp configure] instead of after?

In the Unity SDK, we call [FIRApp configure] when the FirebaseApp object is initially accessed.  i.e when you access the FirebaseApp.DefaultInstance property - or anything that depends upon this proprety - we run [FIRApp configure].   If moving your transaction observer works then you can make sure you add it before you touch Firebase APIs.

Cheers,
Stewart

To unsubscribe from this group and stop receiving emails from it, send an email to firebase-talk+unsubscribe@googlegroups.com.

To post to this group, send email to fireba...@googlegroups.com.

hoshin...@gmail.com

unread,
Feb 1, 2017, 10:46:14 AM2/1/17
to Firebase Google Group

Hello Stewart,


With that in mind, does this work if you add the transaction observer before [FIRApp configure] instead of after?

I can tell that this may work for the issue.

But I think there are two problems with this solution.


① When updatedTransactions run and transaction gets finish before the Firebase be initialized, there is a possibility that the transaction might not be aggregated by Firebase Analytics.


② The flow of addTransactionObserver⇛updatedTransactions runs asynchronously. Therefore, even if you add the addTransactionObserver before [FIRApp configure], the following problem may arise:

  1. addTransactionObserver

  2. [FIRApp configure]

  3. updatedTransactions(This won’t be called since Firebase has been initialized)


What I really hope for is that the SDK would be fixed as the following:

“No problem will occur even if the developer calls the addTransactionObserver after [FIRApp configure]”

Is it hard to fix this?  


Cheers,

2017年1月31日火曜日 7時43分12秒 UTC+9 Stewart Miles:
Reply all
Reply to author
Forward
0 new messages