Post

Replies

Boosts

Views

Activity

How to know if a product has been purchased
Hi guys.Apple is asking me that if a Non-Consumable product has been purchased by a user and the user decides to delete and reinstall the App, then I must present a "Restore" instead than "Buy" button.To check if a product has been purchased I am using NSUserDefaults, like this: public init(productIds: Set<ProductIdentifier>) { self.productIdentifiers = productIds for productIdentifier in productIds { let purchased = NSUserDefaults.standardUserDefaults().boolForKey(productIdentifier) if purchased { purchasedProductIdentifiers.insert(productIdentifier) print("Previously purchased: \(productIdentifier)") } else { print("Not purchased: \(productIdentifier)") } } super.init() SKPaymentQueue.defaultQueue().addTransactionObserver(self) }But, if the user deletes the App, this information is lost.So, Is there anyway to ask to SKPayment if a product has been purchase? I guess there is because they are asking me that. But I didnt find it.
4
0
2.3k
Jun ’16
UIPopoverController deprecated in iOS 9.0
I have the next code: var imageArray = [UIImage]() for photo in self.selectedPhotos { imageArray.append(photo.thumbnail!) } let shareScreen = UIActivityViewController(activityItems: imageArray, applicationActivities: nil) let navigationItemElement:UIBarButtonItem = (self.navigationItem.rightBarButtonItems?.first)! let popover = UIPopoverController(contentViewController: shareScreen) popover.presentPopoverFromBarButtonItem(navigationItemElement, permittedArrowDirections: UIPopoverArrowDirection.Any, animated: true)And I have the next warning:'UIPopoverController' was deprecated in iOS 9.0: UIPopoverController is deprecated. Popovers are now implementd as UIViewController presentations. Use a modal presentation style of UIModalPresentationPopover and UIPopoverPresentationController.Anyone has an example?
1
0
3.1k
Sep ’15