private let serverURL = "https://example.com/package.pkg"
func downloadPackage() {
guard let packageURL = URL(string: serverURL) else {
print("Failed to create URL for package")
return
}
let downloadTask = URLSession.shared.downloadTask(with: packageURL) { (url, response, error) in
if let error = error {
print("Failed to download package: \(error.localizedDescription)")
return
}
guard let fileURL = url else {
print("Failed to retrieve downloaded file URL")
return
}
// Move the downloaded file to desired location
let fileManager = FileManager.default
let documentsDirectoryURL = fileManager.urls(for: .documentDirectory, in: .userDomainMask).first!
let destinationURL = documentsDirectoryURL.appendingPathComponent("package.pkg")
do {
try fileManager.moveItem(at: fileURL, to: destinationURL)
print("Package downloaded successfully")
// Perform further actions with the downloaded package
} catch let error {
print("Failed to move downloaded package: \(error.localizedDescription)")
}
}
downloadTask.resume()
}
}
// Usage:
let inAppPurchaseManager = InAppPurchaseManager()
inAppPurchaseManager.startObservingTransactions()
// Call purchaseProduct() method when user completes the in-app purchase
inAppPurchaseManager.purchaseProduct(productId: "com.example.package") // Replace with your product identifier
Do you think this accepted by Apple?
I've had the non consumable IAP approved by Apple but how does Apple verify the package? is this done by Xcode when I create the archive?
Post
Replies
Boosts
Views
Activity
Just to clarify...
Where do I host the PKG file?
How do I add the URL in the main app or do I have to do this in apple connect?
So can anyone tell me the recommended way to deal with this; I have an app since 2016 which uses non consumable content. I just tried to upload a new non consumable as a pkg to apple but noticed there was no facility to add to the IAP within 'connect'. What is the best way forward with this?