GithubHelp home page GithubHelp logo

apphud / apphudsdk Goto Github PK

View Code? Open in Web Editor NEW
196.0 7.0 33.0 3.99 MB

Build, Measure and Grow iOS subscription business

Home Page: https://apphud.com

License: MIT License

Swift 99.73% Ruby 0.27%
ios in-app-purchase in-app-purchases in-app-receipt receipt-validation swift5 swift-5 subscription apphud storekit iap iap-verification skproduct skpaymentqueue purchase purchases

apphudsdk's People

Contributors

akhrameev avatar andreyoshev avatar ftp27 avatar levochkaa avatar nvelichkin avatar panl avatar ren6 avatar vlr-code avatar xander84 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

apphudsdk's Issues

A lot of errors after update to 2.5.0

The application is not buildable after updating to version 2.5.0 via SPM.
There are no such problems with version 2.4.4.
Xcode Version 13.2.1 (13C100)

Screen Shot 2022-01-04 at 16 25 23

Deferred purchase

Hey! I am trying to test deferred purchases. When I click the Buy button, I see the "Ask Permission" alert, when I click "Cancel" or "Ask", nothing happens, the ApphudDelegate does not fire and my activityIndicator is visible always. I have to process these purchases in func paymentQueue (_ queue: SKPaymentQueue, updatedTransactions transactions: [SKPaymentTransaction]) {}

How do I know if a deferred purchase has been used through the ApphudDelegate?
Снимок экрана 2022-01-11 в 19 38 34

Delegate method for API call errors.

Please add delegate methods for errors in API calls because it's completely not transparent when and why these issues happen.
I.e. when paywalls/products cannot be loaded.

How to use example?

I open example project, select StoreKitApphudSDKDemo, build project and in console see err:
[Apphud] Failed to load SKProducts from the App Store, because product identifiers are invalid:
["com.apphud.gold", "com.apphud.monthly_promo"]

and what i see in simulator
https://ibb.co/17ZJfPQ

How can i fix it?

iPhone SE (14.4) simulator, AppHud 2.5.7 not loading SKProducts

Hi!
I try to get SKProducts from ApphudProduct, but got nil in iPhone SE 14.4, before all worked fine.

My steps:
Apphud.paywallsDidLoadCallback { paywalls in
// retrieve default paywall
let paywall = paywalls.first(where: { $0.isDefault })
var products: [ApphudProduct] = []

        // retrieve the products [ApphudProduct] from current paywall
        if let paywall = paywall {
            products = paywall.products
            
            for product in paywall.products {
                print("test:", product.productId, product.skProduct) 
            }
        }
    }

what i get: "test: com.kushman.nevergame.annual nil", but in other simulators, like iPhone 13 pro max 15.2 i got: "com.kushman.nevergame.annual Optional(<SKProduct: 0x600002905270>)"

Can u help me?

Corner case when user is not registered and products not loaded automatically

  1. first launch after install without wifi
  2. wait 5 minutes
  3. enable wifi
  4. try to subscribe

because of the max number of attempts Apphud will give up on trying to register user and fetch products.

I use refreshStoreKitProducts to force it but with SwiftUI it's a bit awkward.

I think there shouldn't be a limit, also 30+ seconds retry is too much to wait for the user if he goes online.
I understand that you try to reduce load on your servers but there is no load if there's no connection. Maybe you should check the error generated by the request.

Requires minimum iOS 11.2

"Apphud SDK requires minimum iOS 11.2" - are you serious?

My application supports iOS 9 and above, for the sake of your SDK I will not raise the "Deployment Target" version. Since I have many clients on iOS 9 and 10.
How can I use the SDK and your service now?

Buying in sandbox

In sandbox after succesing buy non-renewing purchase, i don't see an active purchases.

iOS 14 Beta Failed to load SKProducts from the App Store

[12:15:06 PM] [Apphud] Failed to load SKProducts from the App Store, error: Error Domain=SKErrorDomain Code=0 "UNKNOWN_ERROR" UserInfo={NSLocalizedDescription=UNKNOWN_ERROR, NSUnderlyingError=0x6000008b4870 {Error Domain=ASDErrorDomain Code=507 "Error decoding object" UserInfo={NSLocalizedDescription=Error decoding object, NSLocalizedFailureReason=Attempted to decode store response}}}

MacOS support

Hello! Thank you for great service!
Do you plan to add MacOS support to the SDK?

I add SPM library to MacOs target, but the application is not building.

Apphud does not display the purchase when using the iPhone Simulator and Local StoreKit Testing.

I made the purchase on the simulator, and they showed up in the Manage Transaction Window, but it didn't appear on the simulator. Sometimes, Apphud displayed a Refunded subscription, but I didn't find a pattern. For some reason, it sometimes appeared.

The error is reproduced many times in the simulator when purchasing any subscriptions.

iOS v17.2
Xcode Version 15.1 (15C65)
ApphudSDK v3.1.4
Screenshot 2023-12-21 at 2 46 49 AM
Screenshot 2023-12-21 at 2 47 07 AM

Crashes in SDK (placements)

Started to appear after updating from 3.2.8 to 3.3.2.
My guess is that storeKitProductsFetchedCallbacks can get the same callback twice, somehow.
The stacktrace is always the same for us, we call only Apphud.placement on our paywall appear/disappear

Crashed: com.apple.main-thread
0  libswiftCore.dylib             0x383fc _assertionFailure(_:_:file:line:flags:) + 264
1  libswift_Concurrency.dylib     0x5824 CheckedContinuation.resume(returning:) + 504
2  ArtWorkout                     0x3e1118 closure #1 in closure #1 in static Apphud.placements(maxAttempts:) + 4381184280
3  ArtWorkout                     0x3e9958 partial apply for closure #1 in closure #1 in static Apphud.paywalls(maxAttempts:) + 4381219160
4  ArtWorkout                     0x3a2be4 closure #1 in closure #1 in ApphudInternal.fetchOfferingsFull(maxAttempts:callback:) + 255 (ApphudInternal+Product.swift:255)
5  ArtWorkout                     0x3a6f6c partial apply for thunk for @escaping @callee_guaranteed (@guaranteed ApphudError?) -> () + 4380946284 (<compiler-generated>:4380946284)
6  ArtWorkout                     0x39f99c ApphudInternal.performAllStoreKitProductsFetchedCallbacks(error:) + 43 (ApphudInternal+Product.swift:43)
7  ArtWorkout                     0x3a4c9c specialized ApphudInternal.handleDidFetchAllProducts(storeKitProducts:error:) + 128 (ApphudInternal+Product.swift:128)
8  libswift_Concurrency.dylib     0x41ac4 swift::runJobInEstablishedExecutorContext(swift::Job*) + 436
9  libswift_Concurrency.dylib     0x42d54 swift_job_runImpl(swift::Job*, swift::ExecutorRef) + 72
10 libdispatch.dylib              0x128a8 _dispatch_main_queue_drain + 744
11 libdispatch.dylib              0x125b0 _dispatch_main_queue_callback_4CF + 44
12 CoreFoundation                 0x3701c __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 16
13 CoreFoundation                 0x33d28 __CFRunLoopRun + 1996
14 CoreFoundation                 0x33478 CFRunLoopRunSpecific + 608
15 GraphicsServices               0x34f8 GSEventRunModal + 164
16 UIKitCore                      0x22c62c -[UIApplication _run] + 888
17 UIKitCore                      0x22bc68 UIApplicationMain + 340
18 UIKitCore                      0x4563d0 __swift_destroy_boxed_opaque_existential_1Tm + 12220
19 ArtWorkout                     0x26e84 main + 4377276036 (AppDelegate.swift:4377276036)
20 ???                            0x1c7e56dcc (Missing)

Deferred purchase

Hey! I am trying to test deferred purchases. When I click the Buy button, I see the "Ask Permission" alert, when I click "Cancel" or "Ask", nothing happens, the ApphudDelegate does not fire and my activityIndicator is visible always. I have to process these purchases in func paymentQueue (_ queue: SKPaymentQueue, updatedTransactions transactions: [SKPaymentTransaction]) {}

How do I know if a deferred purchase has been used through the ApphudDelegate?
Is it possible to determine deferred purchase in Apphud.purchase() method?

148984612-93ae3297-0fa0-47fa-9ff4-35474b867547

Login/logut methods in ios

Hi.
In my ios app there are authorization screens using mail and password. There are 2 states of the application: the user is logged in and not.

  1. When the application is launched and the user is not logged in (I do not have an email user), do I need to call the Append.stat(apiKey: "YOUR_API_KEY") method
  2. When the user has logged in, which method should be called, App hub.start(apiKey: "YOUR_API_KEY", userID: "YOUR_USER_ID") or Apphud.startManually(apiKey: "YOUR_API_KEY", userID: "YOUR_USER_ID", DeviceID: "YOUR_USER_ID")?
  3. When the user logs into the application, do I need to call the Append.logout() method?
  4. In case 1 when the application is launched and the user is not logged in and I do not call the App hub.start method(apiKey: "YOUR_API_KEY"), then I get the message <SKPaymentQueue: 0x60000044c460>: No observers found that response to "paymentQueue:shouldAddStorePayment:forProduct:", will not check for purchase intents.
  5. If the user logged out (Apphud.logout()) and then logged in again with the same mail, then on the Apphud website in the users section I see two users with the same mail. Is this normal?
  6. I understand correctly that if I called the AApphud.start(apiKey: "YOUR_API_KEY", userID: "YOUR_USER_ID"), made a subscription, then called the Apphud.logout() and then called the Apphud.start(apiKey: "YOUR_API_KEY", userID: "YOUR_USER_ID") but with a different USER ID, then if I try to restore purchases from the second user, the purchase made by the first user should not be restored from the second user?

Let me know how to correctly identify the user if the authorization system is used in the application, I'm confused :)

Crash on setUserProperty

We are getting such crashes after updating from 3.2.3 to 3.2.8

Crashed: com.apple.main-thread
0  ArtWorkout                     0x3c496c closure #1 in ApphudInternal.setUserProperty(key:value:setOnce:increment:) + 311 (ApphudInternal+UserUpdate.swift:311)
1  ArtWorkout                     0x3c48b0 closure #1 in ApphudInternal.setUserProperty(key:value:setOnce:increment:) + 192 (ApphudUserProperty.swift:192)
2  ArtWorkout                     0x3cdb60 closure #1 in ApphudInternal.performWhenUserRegistered(callback:) + 499 (ApphudInternal.swift:499)
3  libswift_Concurrency.dylib     0x4d764 swift::runJobInEstablishedExecutorContext(swift::Job*) + 436
4  libswift_Concurrency.dylib     0x4e9c8 swift_job_runImpl(swift::Job*, swift::ExecutorRef) + 72
5  libdispatch.dylib              0x124b4 _dispatch_main_queue_drain + 748
6  libdispatch.dylib              0x121b8 _dispatch_main_queue_callback_4CF + 44
7  CoreFoundation                 0x3751c __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 16
8  CoreFoundation                 0x34218 __CFRunLoopRun + 1996
9  CoreFoundation                 0x33968 CFRunLoopRunSpecific + 608
10 GraphicsServices               0x34e0 GSEventRunModal + 164
11 UIKitCore                      0x22aedc -[UIApplication _run] + 888
12 UIKitCore                      0x22a518 UIApplicationMain + 340
13 UIKitCore                      0x463734 __swift_destroy_boxed_opaque_existential_1Tm + 12004
14 ArtWorkout                     0x1472c main + 120 (AppDelegate.swift:120)
15 ???                            0x1abadad84 (Missing)

These are happening 10 times more:

Crashed: com.apple.main-thread
0  ArtWorkout                     0x3c680c specialized MutableCollection._halfStablePartition(isSuffixElement:) + 472 (<compiler-generated>:472)
1  ArtWorkout                     0x3c66fc specialized MutableCollection._halfStablePartition(isSuffixElement:) + 200 (<compiler-generated>:200)
2  ArtWorkout                     0x3c48b0 closure #1 in ApphudInternal.setUserProperty(key:value:setOnce:increment:) + 192 (ApphudUserProperty.swift:192)
3  ArtWorkout                     0x3cdb60 closure #1 in ApphudInternal.performWhenUserRegistered(callback:) + 499 (ApphudInternal.swift:499)
4  libswift_Concurrency.dylib     0x4d764 swift::runJobInEstablishedExecutorContext(swift::Job*) + 436
5  libswift_Concurrency.dylib     0x4e9c8 swift_job_runImpl(swift::Job*, swift::ExecutorRef) + 72
6  libdispatch.dylib              0x124b4 _dispatch_main_queue_drain + 748
7  libdispatch.dylib              0x121b8 _dispatch_main_queue_callback_4CF + 44
8  CoreFoundation                 0x3751c __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 16
9  CoreFoundation                 0x34218 __CFRunLoopRun + 1996
10 CoreFoundation                 0x33968 CFRunLoopRunSpecific + 608
11 GraphicsServices               0x34e0 GSEventRunModal + 164
12 UIKitCore                      0x22aedc -[UIApplication _run] + 888
13 UIKitCore                      0x22a518 UIApplicationMain + 340
14 UIKitCore                      0x463734 __swift_destroy_boxed_opaque_existential_1Tm + 12004
15 ArtWorkout                     0x1472c main + 120 (AppDelegate.swift:120)
16 ???                            0x1ae5dad84 (Missing)

I've checked the diff, and found out that preparePropertiesParams async method was added and call to it in updateUserProperties in Task.

My guess is that SDK is trying to access pendingUserProperties both from main thread (see setUserProperty) and background thread (see updateUserProperties) simultaneously, what leads to a crash.

Possible fix would be just to limit pendingUserProperties to MainActor, as well as preparePropertiesParams or use an NSLock on pendingUserProperties

Apphud does not get back the subscriptions using Apphud.subscriptions() in the Widget (widget extension, SwiftUI, WidgetKit) on the real iPhone in Sandbox

I purchased the subscription on the real iOS device in sandbox mode, and it showed up in the Manage Transaction Window. But when I try to get subscriptions in the Widget (widget extension, SwiftUI, WidgetKit) and use the "Apphud.subscriptions()" method, I don't get any subscriptions. But when I use the same "Apphud.subscriptions()" method in the iOS app target, this method works and gets subscriptions.

iOS v17.2
Xcode Version 15.1 (15C65)
ApphudSDK v3.2.5
Frameworks: SwiftUI, WidgetKit
Screenshot 2024-01-09 at 8 35 51 PM
Screenshot 2024-01-09 at 8 36 27 PM

ApphudDelegate Bug?

newest 2.8.8 code

internal func submitReceipt(product: SKProduct?, apphudProduct: ApphudProduct?, transaction: SKPaymentTransaction?, receiptString: String?, notifyDelegate: Bool, eligibilityCheck: Bool = false, callback: ApphudErrorCallback?) {
        self.submitReceipt(product: product,
                           apphudProduct: apphudProduct,
                           transactionIdentifier: transaction?.transactionIdentifier,
                           transactionProductIdentifier: transaction?.payment.productIdentifier,
                           transactionState: transaction?.transactionState,
                           receiptString: receiptString,
                           notifyDelegate: eligibilityCheck,
                           callback: callback)
}

error

notifyDelegate: eligibilityCheck,

should be?

notifyDelegate: notifyDelegate,
eligibilityCheck: eligibilityCheck 

Disable IDFA collection

I call Apphud.disableIDFACollection() before Apphud.start(apiKey: ""), but when I submit app to app store connect, app store connect still says that my app contains IDFA, is there any way to solve this ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.