Still seeing this bug on Xcode 12.4 on Catalina. Has anyone seen an update on it from Apple?
Post
Replies
Boosts
Views
Activity
@cwoloszynski, I'm having the exact issue you discussed and I can't quite understand how you fixed it. For the exported/imported type identifier "conforms to" did you finally use "com.apple.package"?
I want a directory structure that looks like:
<UserChosenName.pspkg>/. // directory package containing my document data and images
PhraseSet.dat // regular file with serialized data from snapshot
Images/ // subdirectory for images (populated directly from my app as needed)
Image0.png
Image1.png
....
I'm using the following class for the FileWrapper to encapsulate what I think I need to do. Can you see something I'm doing incorrectly?
var snapshot: Data
init(withSnapshot: Data) {
self.snapshot = withSnapshot
let sWrapper = FileWrapper(regularFileWithContents: snapshot)
let dWrapper = FileWrapper(directoryWithFileWrappers: [:])
super.init(directoryWithFileWrappers: ["PhraseSet.dat" : sWrapper,
"Images" : dWrapper ])
// TO BE DONE: create subdirectory for images. Writing of
// images is done outside of the ReferenceFileDocument
// functionality.
}
override func write(to url: URL,
options: FileWrapper.WritingOptions = [],
originalContentsURL: URL?) throws {
if let fileWrappers = fileWrappers {
for (_, wrapper) in fileWrappers {
try wrapper.write(to: url, options: options,
originalContentsURL: originalContentsURL)
}
}
}
required init?(coder inCoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
}
Here's an answer to the part of your question regarding signing in. There are 3 ways of testing in-app purchases, as I understand it: (1) in Xcode; (2) with the Sandbox; and (3) in TestFlight. [I am assuming you are not trying to set up your own server, but are making purchases from an app on your device.'
I think you may be confusing the first two methods. To test in Xcode, you supply a .StoreKit Configuration file and select the file on the Product / Scheme / Edit Scheme page in Xcode. This lets you test locally on the simulator and does not use a sandbox account.
To test with Sandbox you disable the .StoreKit Configuration file by selecting "none" in the Xcode Product / Scheme / Edit Scheme page. Then you must define products in App Store Connect (this will be the "real" data that you previously emulated in the .storekit file) and also create a Sandbox tester account in App store Connect. Now you must test by running from Xcode on your device (I think you can't use the simulator here). When you try to make a purchase you should get prompted to sign in using the Sandbox tester account. Subsequently you can sign in / sign out to Sandbox account on your device by going to Settings / App Store and scrolling way down to the bottom where you will see a section for Sandbox accounts.
Sorry, but I can't answer your question about "https://sandbox.itunes.apple.com/verifyReceipt".
Good luck!
Tom
@Phuz3r, I'm seeing the same behavior. When testing in Sandbox using a Sandbox account, upgrades seem to work correctly. When I look at the resulting transaction and subscription information I can see that the higher level subscription starts immediately and the original lower level subscription gets the flag "upgraded" set to true.
Downgrades, however, don't seem to work properly. I don't get a popup confirming a purchase and the higher level subscription remains in effect.
Both upgrades and downgrades seem to work properly, however, if I use the .StoreKit Configuration file with local Xcode testing instead of Sandbox.
I really would like to figure out how to test my subscriptions fully in Sandbox! I need to release my app soon and don't want to do it if the subscriptions aren't working!
In the WWDC 2021 StoreKit Demo, to get the set of statuses for a subscription group, they get the subscription statuses for a particular product and then use that, assuming all the products in the subscription group share the same set of statuses. (See the function "updateSubscriptionStatus()."
This was simple in the demo since there's only one subscription group. If you have multiple subscription groups then I guess you'd have to run a similar function on a representative product of the subscription group you're interested in.
@jrg405, you can delete previous transactions from within Xcode. When the app is running you can tap on the "Manage StoreKit Transactions" button that is the last of several buttons that control the debugger. [Find the button you tap to pause the debugger and then look several icons to the right of that.]
This brings up a window with all the transactions that have been created. You can select a transaction and carry out various options like cancelling it. You can also delete one or more transactions. If you delete them all then you get reset to the original state, which is what I think you are wanting to do.
My experience with Sandbox testing is that subscription changes are sometimes significantly delayed. For example, sometimes if I cancel a subscription the cancellation doesn't take effect until much later than the subscription expiration time. If I just wait several minutes then the cancellation takes effect. I thought this might be due to Storekit caching so I've tried signing out and back in, removing the app, etc. but that doesn't seem to help.
So one suggestion: if the subscription status doesn't seem right, give it some more time and see if that fixes it.
I'm having the same issue with Xcode 13.4 and StoreKit 2: My in-app purchase for an auto renewing subscription works fine at the beginning, and when I set "interrupted purchase" in App Store Connect I get a dialog as expected telling me that I need to accept new conditions.
However, when I clear the "interrupted purchase" in App Store Connect, that has no effect except that now, after tapping on "OK" at the terms-and-conditions alert, I get a modal dialogue that says "Cannot Connect", with a "retry" button. [Tapping "retry" doesn't help]. At any rate my purchase fails.
Even stranger: I have 5 sandbox tester ids (let's call these sb1 through sb5) and this affects the original one, sb1. If I log out of sb1 and log in as sb2, which does NOT have interrupted purchase set, it acts as if the purchase HAS been interrupted. I have tried logging out and back in, deleting and rebuilding the app, changing the geographical region of sb1 (as suggested above), all to no avail.
Now if I log in to another of my accounts, sb3, which does NOT have interrupted purchase set, it behaves properly - the purchase succeeds. If I log out of sb3 and go back to sb1 its purchase continues to fail even though NONE of my tester accounts have interrupted purchase set.
Is it possible that, on interruption, there's an additional transaction or message I need to handle? But then why did sb3 work properly and sb2 didn't?