Giter Site home page Giter Site logo

glassfy / ios-sdk Goto Github PK

View Code? Open in Web Editor NEW
32.0 4.0 4.0 203 KB

Open source SDK to quickly integrate subscriptions, stop worring about code maintenance, and getting advanced real-time data. Full support for iOS, iPadOS, WatchOS, MacOS

Home Page: https://glassfy.io

License: MIT License

Ruby 0.32% Objective-C 99.15% Swift 0.35% C 0.18%
ios swift objcective-c objc storekit storekit-wrapper storekit2 iaps iap subscriptions

ios-sdk's Introduction

Platform License CocoaPod SwiftPM compatible

Glassfy iOS SDK

Is the client for Glassfy: a subscription revenue optimisation infrastructure for mobile applications.

Requirements

  • Swift and Objective-C Projects
  • iOS 10.0 or greater / macOS 10.15 or greater

Installation

Our SDK can be easly integrated through Cocoapods or Swift Package Manager

Integrate using Cocoapods

Add the pod to your Podfile:

pod 'Glassfy', '~> 1.4.2'

Then, run the following command:

pod install

Integrate using Swift Package Manager

You can use Swift Package Manager to integrate Glassfy SDK in your application.

  • In your Xcode project select file -> Add Packages...
  • Enter the Glassfy GitHub URL: https://github.com/glassfy/ios-sdk.
  • Set the version “Up to Next Major” to the version you want to use.

More Info

Check the documentation at docs.glassfy.io to learn details on implementing and using Glassfy SDK.

License

This SDK is available under the MIT license.

ios-sdk's People

Contributors

lgarbo avatar marcopifferi 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

Watchers

 avatar  avatar  avatar  avatar

ios-sdk's Issues

iOS: verifyPermission returns inValid for a successful purchase

I've an iOS app which uses Glassfy for purchasing subscriptions.

The initial app release was accepted in AppStore, but after I added a new Sku, Glassfy process started showing errors - initially while fetching products and later on while verifying the purchased subscription.

I was able to go around the fetching products issue by removing all Skus from offering and adding again, but the verification of permission seems to fail all the time now.

Below is my code snippet for verifying subscription

   private func verifyPermission(_ permission: Glassfy.Permission) {
        log(
            "Permission verified and it is \(permission.isValid ? "valid ✅" : "invalid ⛔️")"
        )
        DispatchQueue.main.async {
            self.isSubscribed = permission.isValid
        }
    }

And below is my code for purchasing monthly subscription

public func purchaseMonthlySubscription() async -> SubscriptionResult? {
        do {
            log("Purchasing subscription..")
            guard let monthlySku = monthlySku else {
                return .error(
                    message: "Product cannot be fetched.\nPlease check your internet connection and try again."
                )
            }
            let transaction = try await Glassfy.purchase(sku: monthlySku)
            let subscriberId = transaction.permissions.subscriberId ?? ""
            await StorageManager.shared.saveSubscriberId(subscriberId)
            if let permission = transaction.permissions[pmpPermissions] {
                checkHasPurchases(permission)
                verifyPermission(permission)
                if permission.isValid {
                    return .success
                }
            }

            return .error(
                message: "Permission cannot be granted.\nPlease try again later."
            )
        } catch {
            if let error = error as? SKError {
                switch error.code {
                case .paymentCancelled:
                    log("Payment cancelled 💸")
                    return nil
                default:
                    print("")
                    log(error)
                }
            }
            return .error(
                message: "Something went wrong while subscribing.\nPlease try again later."
            )
        }
    }

Please note - the issue started appearing after adding a new SKU; the initial app worked fine.

Please advise.

Swift package name conflicts

When installing using SPM Xcode picks the package name up as ios-sdk

This is really generic and is:

  1. Hard to reason in the list of packages in xcode
  2. Causing conflicts with other packages that are names the same, as Xcode doesn't seem smart enough to differentiate between the two packages throwing the following error. "The project already depends on: ios-sdk"

An example of one conflict with a package doing the same thing is: UXCam

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.