You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Support for consumable, non-consumable and non-renewing subscription in-app purchases.
* Apple Search Ads attribution support
* Added many new methods to SDK.
* Added new class `ApphudNonRenewingPurchase` which contains product identifier, purchase date and and optional cancellation date.
* Apphud SDK now tries to re-register user and re-fetch products when application becomes active if there were errors on app launch; for example, if there was no Internet connection.
Returns array of subscriptions that user ever purchased. Empty array means user never purchased a subscription. If you have just one subscription group in your app, you will always receive just one subscription in an array.
22
22
23
-
This method is called when any subscription in an array has been changed (for example, status changed from `trial` to `expired`).
24
-
25
-
In most cases you don't need this method because you already have completion blocks in `purchase`, `purchasePromo` and `submitReceipt` methods. However this method may be useful to detect whether subscription was purchased in Apphud's puchase screen.
23
+
This method is called when subscription is purchased or updated (for example, status changed from `trial` to `expired` or `isAutorenewEnabled` changed to `false`). SDK also checks for subscription updates when app becomes active.
Returns array of `SKProduct` objects after they are fetched from StoreKit. Note that you have to add all product identifiers in Apphud.
48
51
49
-
You can use this delegate method or observe for `Apphud.didFetchProductsNotification()` notification.
52
+
You can use `productsDidFetchCallback` callback or observe for `didFetchProductsNotification()` or implement `apphudDidFetchStoreKitProducts` delegate method. Use whatever you like most.
Branch is implemented and doesn't require any additional code from Apphud SDK
111
115
More details: https://docs.apphud.com/integrations/attribution/branch
@@ -167,16 +171,34 @@ final public class Apphud: NSObject {
167
171
/**
168
172
This notification is sent when SKProducts are fetched from StoreKit. Note that you have to add all product identifiers in Apphud.
169
173
170
-
You can observe for this notification or implement `apphudDidFetchStoreKitProducts` delegate method.
174
+
You can use `productsDidFetchCallback` callback or observe for `didFetchProductsNotification()` or implement `apphudDidFetchStoreKitProducts` delegate method. Use whatever you like most.
This callback is called when SKProducts are fetched from StoreKit. Note that you have to add all product identifiers in Apphud.
182
+
183
+
You can use `productsDidFetchCallback` callback or observe for `didFetchProductsNotification()` or implement `apphudDidFetchStoreKitProducts` delegate method. Use whatever you like most.
Refreshes SKProducts from the App Store. You have to add all product identifiers in Apphud.
191
+
192
+
__Note__: You shouldn't call this method at app launch, because Apphud SDK automatically fetches products during initialization. Only use this method as a fallback.
Returns array of `SKProduct` objects that you added in Apphud.
178
200
179
-
Note that this method will return `nil` if products are not yet fetched. You should observe for `Apphud.didFetchProductsNotification()` notification or implement `apphudDidFetchStoreKitProducts` delegate method.
201
+
Note that this method will return `nil` if products are not yet fetched. You should observe for `Apphud.didFetchProductsNotification()` notification or implement `apphudDidFetchStoreKitProducts` delegate method or set `productsDidFetchCallback` block.
@@ -197,38 +219,42 @@ final public class Apphud: NSObject {
197
219
/**
198
220
Purchases product and automatically submits App Store Receipt to Apphud.
199
221
200
-
__Note__: This method automatically sends in-app purchase receipt to Apphud, so you don't need to call `submitReceipt` method.
222
+
__Note__: You are not required to purchase product using Apphud SDK methods. You can purchase subscription or any in-app purchase using your own code. App Store receipt will be sent to Apphud anyway.
201
223
202
-
- parameter product: Required. This is an `SKProduct` object that user wants to purchase.
203
-
- parameter callback: Optional. Returns `ApphudSubscription` object if succeeded and an optional error otherwise.
224
+
- parameter product: Required. This is an `SKProduct` object that user wants to purchase.
Purchases product and automatically submits App Store Receipt to Apphud. This method doesn't wait until Apphud validates receipt from Apple and immediately returns transaction object. This method may be useful if you don't care about receipt validation in callback.
233
+
234
+
__Note__: You are not required to purchase product using Apphud SDK methods. You can purchase subscription or any in-app purchase using your own code. App Store receipt will be sent to Apphud anyway.
235
+
236
+
- parameter product: Required. This is an `SKProduct` object that user wants to purchase.
237
+
- parameter callback: Optional. Returns optional `SKPaymentTransaction` object and an optional error.
__Deprecated__. Starting now Apphud SDK automatically tracks all your in-app purchases and submits App Store receipt to Apphud. You can safely remove this method from your code. If you were using callback, you can use `apphudSubscriptionsUpdated` delegate method instead.
225
-
*/
226
-
@available(*, deprecated, message:"Starting now Apphud SDK automatically tracks all your in-app purchases and submits App Store receipt to Apphud. You can safely remove this method from your code. If you were using callback, you can use `apphudSubscriptionsUpdated` delegate method instead.")
Returns an array of all standard in-app purchases (consumables, nonconsumables or nonrenewing subscriptions) that this user has ever purchased. Purchases are cached on device. This array is sorted by purchase date. Apphud only tracks consumables if they were purchased after integrating Apphud SDK.
Returns `true` if current user has purchased standard in-app purchase with given product identifier. Returns `false` if this product is refunded or never purchased. Includes consumables, nonconsumables or non-renewing subscriptions. Apphud only tracks consumables if they were purchased after integrating Apphud SDK.
299
+
300
+
__Note__: Purchases are sorted by purchase date, so it returns Bool value for the most recent purchase by given product identifier.
Implements `Restore Purchases` mechanism. Basically it just sends current App Store Receipt to Apphud and returns subscriptions info.
266
308
@@ -269,33 +311,33 @@ final public class Apphud: NSObject {
269
311
You should use this method in 2 cases:
270
312
* Upon tap on `Restore Purchases` button in your UI.
271
313
* To migrate existing subsribers to Apphud. If you want your current subscribers to be tracked in Apphud, call this method once at the first launch.
272
-
- parameter callback: Required. Returns array of subscription (or subscriptions in case you more than one subscription group). Returns nil if user never purchased a subscription.
314
+
- parameter callback: Required. Returns array of subscription (or subscriptions in case you have more than one subscription group), array of standard in-app purchases and an error. All of three parameters are optional.
If you already have a live app with paying users and you want Apphud to track their subscriptions, you should import their App Store receipts into Apphud. Call this method at launch of your app for your paying users. This method should be used only to migrate existing paying users that are not yet tracked by Apphud.
321
+
If you already have a live app with paying users and you want Apphud to track their purchases, you should import their App Store receipts into Apphud. Call this method at launch of your app for your paying users. This method should be used only to migrate existing paying users that are not yet tracked by Apphud.
280
322
281
323
Example:
282
324
283
325
````
284
326
// hasPurchases - is your own boolean value indicating that current user is paying user.
285
327
if hasPurchases {
286
-
Apphud.migrateSubscriptionsIfNeeded {_ in}
328
+
Apphud.migratePurchasesIfNeeded { _, _, _ in}
287
329
}
288
330
````
289
331
290
332
__Note__: You can remove this method after a some period of time, i.e. when you are sure that all paying users are already synced with Apphud.
@@ -409,6 +451,20 @@ final public class Apphud: NSObject {
409
451
ApphudUtils.enableDebugLogs()
410
452
}
411
453
454
+
/**
455
+
Automatically finishes all pending transactions. By default, Apphud SDK only finishes transactions, that were started by Apphud SDK, i.e. by calling any of `Apphud.purchase..()` methods.
456
+
457
+
However, when you debug in-app purchases and/or change Apple ID too often, some transactions may stay in the queue (for example, if you broke execution until transaction is finished). And these transactions will try to finish at every next app launch. In this case you may see a system alert prompting to enter your Apple ID password. To fix this annoying issue, you can add this method.
458
+
459
+
You may also use this method in production if you don't care about handling pending transactions, for example, downloading Apple hosted content.
460
+
For more information read "Finish the transaction" paragraph here: https://developer.apple.com/library/archive/technotes/tn2387/_index.html
461
+
462
+
__Note__: Only use this method if you know what you are doing. Must be called before Apphud SDK initialization.
463
+
*/
464
+
@objcpublicstaticfunc setFinishAllTransactions(){
465
+
ApphudUtils.shared.finishTransactions =true
466
+
}
467
+
412
468
/**
413
469
This method must be called before SDK initialization. Apphud will send all subscription events of current user to your test analytics, if test api keys are set in integrations dashboard.
0 commit comments