Posts

Post not yet marked as solved
0 Replies
432 Views
I am testing an iPhone app paired with its Watch app. Build is Success, then the iPhone simulator launches and the screen appears correctly, then nothing. The corresponding simulator for the watch screen doesn't show up. In the debug window, I get "[WC] WCSession counterpart app not installed". That problem didn't happen when I started the first tests, then it came in. Have restarted XCode many times and restarted my Mac as well. For the target, I select the iPhone part, and a scheme with an iPhone paired to a watch (S4, 44). I have also tested with three different codes coming from three different sources (tutorials) and get the same problem. On the iPhone simulator, scrolling down, I see my app. Pressing the Install button doesn't do anything. I suspect a problem either in my XCode either in my Mac.Didn't find any info about this message.Thanks for help.
Posted
by OCA92.
Last updated
.
Post not yet marked as solved
11 Replies
6.7k Views
My application offers IAP. On the list screen a Buy button is generated as an Accessory. Pressing Buy starts the IAP process. It goes well to the end (product is now purchased). Instead of generating a Checkmark in the place of the Buy after purchase, I generate a Download button, as an Accessory again. Pressing the Download button should save the product content and then a Checkmark should appear. At the moment, the Download button produces the crash with "unrecognized selector sent to instance".In ProductTableViewCell swift which is for managing the View Cell, I have the following :// Préparation de l'affichage de l'accessoire var product: SKProduct? { didSet { guard let product = product else { return } let defaults = UserDefaults.standard let statusCurrentProduct = defaults.string(forKey: product.productIdentifier) //print("Accesory pour \(product.productIdentifier)") // Si produit déjà acheté, afficher une checkmark ou un Download if MyBridgeStoreProducts.store.isProductPurchased(product.productIdentifier) { if statusCurrentProduct == "Purchased" { // Acheté mais Pas encore sauvé //print("générer un bouton Save") accessoryType = .none accessoryView = self.newDownloadButton() } else { accessoryType = .checkmark // "Saved" accessoryView = nil } // Si produit achetable, affichage Buy button } else if IAPHelper.canMakePayments() { //ProductTableViewCell.priceFormatter.locale = product.priceLocale WARNING: garder pour la syntaxe //sérieLabel.text = ProductTableViewCell.priceFormatter.string(from: product.price) WARNING: garder pour la syntaxe accessoryType = .none accessoryView = self.newBuyButton() } else { // Achat non autorisé // detailTextLabel?.text = "Not available" // WARNING: code à conserver pour référence, mais je ne gère pas ce statut } } }Then the code for newDownloadButton is :// Description du bouton Download func newDownloadButton() -> UIButton { let button = UIButton(type: .system) button.setTitleColor(tintColor, for: .normal) button.setTitle(NSLocalizedString("buttonDowload", tableName: "Magasin", value: "Download", comment: " "), for: .normal) button.addTarget(self, action: #selector(ProductTableViewController.downloadButtonTapped(_:)), for: .touchUpInside) button.sizeToFit() return button }Then, in ProductTableViewController swift which manages the VC, I have the code for downloadButtonTapped as is :// Action func pour bouton Download @objc func downloadButtonTapped(_ sender: AnyObject) { // Index de la ligne sélectionnée let indexPath = tableView.indexPathForSelectedRow // Recherche dans les User Defaults du produit sélectionné let selectedProduct: String = headers[(indexPath?.section)!].série[(indexPath?.row)!].sérieAscId let defaults = UserDefaults.standard var statusCurrentProduct = defaults.string(forKey: selectedProduct) if statusCurrentProduct == "Purchased" { // Pas encore sauvé WARNING: normalement, c'est toujours du Purchased (on pourrait supprimer le if) // Sauvegarde de la série let title: String = "Information" let message: String = NSLocalizedString("msgInformationSave", tableName: "Magasin", value: "Saving the purchased series on this device", comment: " ") showAlert(message: message, title: title) saveSérie() // flag le Produit acheté et sauvé statusCurrentProduct = "Saved" defaults.set(statusCurrentProduct, forKey: selectedProduct) // Reload la table pour avoir la checkmark tableView.reloadData() } }My question is simple, what's wrong above to clear that crash. Thanks for your help.
Posted
by OCA92.
Last updated
.
Post not yet marked as solved
0 Replies
760 Views
On a first device, I have purchased 14 non consumables products. Pressing a Restore button, restoreCompletedTransaction is executed and a print (transactions.count) gives 14. All is correct.On a second device, I have not purchased any product yet. Pressing the same Restore button, restoreCompletedTransaction is executed but no transactions are returned. The print is not even executed. My initial expectation was to get 14 transactions on that second device.According to Apple documentation : "restoreCompletedTransactions sends a request to the App Store to restore all of your app’s completed transactions". I was assuming App Store to search for the completed transactions regardless the originating device. Apparently, no.To continue, on the second device I now purchase one product. The Restore button now gives me 1 transaction. That shows restoreCompletedTransaction is tied to the device ????!!!All the above is tested in Sandbox, with the same user.How to explain these differences ? Is this due to Sandbox ? Is it reading App Store for the test user or for a device ?Thanks for any comments
Posted
by OCA92.
Last updated
.