Post

Replies

Boosts

Views

Activity

Reply to Class not being called?
There are a couple of issues here: Firstly, when do you think that line 57 will run? It seems to be declaring a global, which will run when the app starts. This is not something that is often done in an app. It might be safe, or it might not. Really, you want to run this when your table view controller is constructed. Secondly, you don’t call classes. You call functions and methods. Classes are instantiated to create objects. If you feel you don’t fully understand that, you need to take a step back and learn it properly now. It will make things much clearer going forward. So in your class API declaration, you declare a member called dataTask and assign URLSession.dataTask.resume to it. Note that you have not written resume(), so the resume function is not being called - all that it is doing is assigning the function itself - not the result of calling it - to the dataTask member. Since you’re never resuming (i.e. starting) the data task, its completion handler, and hence line 25, will never run. As for how to fix this - start with the first issue. Get rid of the globals on lines 17-19 and 57. Start your download from some method In the table view controller - probably viewDidLoad. (Honestly, it’s a while since I’ve done anything quite like this so I’m not totally sure of the best place.) You quite probably don’t need an additional class for this; put it all in your view controller.
Mar ’25
Reply to How to Verify the Authenticity of an In-App Purchase Receipt from Apple Pay?
users either exit the app before tapping "OK" or experience network issues, preventing the receipt from being sent to my server. Don't .finish() the transaction until your server has responded to confirm it has added the points to the account. If there's a crash or similar, you'll get the unfinished transactions again when the app next runs. So make sure your transaction processing code will process purchases at any time, not only immediately after the user has initiated a purchase in your UI. some users send me a receipt from Apple Pay ... How can I verify the authenticity of these receipts? There is this API: https://developer.apple.com/documentation/appstoreserverapi/look-up-order-id That maps from an identifier in their e.g. emailed receipt to a transaction ID, which you can use to look up their transaction history.
Topic: App & System Services SubTopic: StoreKit Tags:
Mar ’25
Reply to Metal triangle strips uniform opacity.
Looking at your first image, the traditional GPU solution would be to use the stencil buffer to only paint each pixel once. If you have anti-aliased edges, the binary stencil buffer isn't perfect. But you can use the alpha channel in the framebuffer to get a similar but fractional effect. Or you can re-triangulate your triangle strips on the CPU to get a geometry that doesn't self-intersect. You should aim to do that ahead-of-time, but it's not completely impossible to do it for every frame. In your other images with the brush texture, I think that again using the framebuffer alpha as a pseudo-stencil is probably the best solution.
Topic: Graphics & Games SubTopic: Metal Tags:
Mar ’25
Reply to Increased Memory Limit, Extended Virtual Addressing affects on recent iPadOS 18.3
Hi Kevin, Thank you for this interesting post. A decade ago I was struggling with an app that tried to use large memory-mapped read-only data files. By default, we prevented that issue by artificially limiting address space and terminating the app when it hits that limit. That is, you can use the architecture above but doing so won't actually give you access to significantly more memory than you would otherwise have access to, removing most of the benefit this architecture would have provided. So now I know that my inability to map large (multi-gigabyte) files for reading was blocked because you didn't want people to map large files for read/write as a kind of swap. I don't think anyone said that at the time. It's much too late now, but I do wonder if you could have used some other method than simply restricting the virtual memory size, that would have permitted read-only mappings.
Topic: App & System Services SubTopic: Core OS Tags:
Mar ’25
Reply to 30% commission from user to user
You need to answer the more fundamental question of whether in-app-purchase is allowed for this at all. If in-app-purchase is allowed, Apple takes 30% (or 15%) of the total value of the transaction, as well as any applicable taxes. If in-app-purchase is not allowed, you need to provide your own payment processing and Apple take nothing. As to whether in-app-purchase is allowed, the primary question is whether the purchased content is delivered in the app. You talk about "shows" and "lectures", but I take it that these are actually streamed videos; are these presented in your app? I'm not totally familiar with the current rules in this case; I think there are some relatively new exceptions for one-to-one consultations.
Mar ’25
Reply to Not understanding synchronous/asynchronous code
why the test code print("line 64") is being printed after the test code print("line 84") Because the session.dataTask call on line 52 returns immediately and runs the code from line 78 onwards. The call to dataTask.resume on line 80 also returns immediately, having caused the download to start asynchronously. The code in lines 53 to 76 runs only when the download has completed. I would like the program to wait until the results array has been parsed before continuing the code (otherwise it does not have content to present). Waiting in a method like this one would cause the UI to freeze until the download has finished, which is very undesirable. You need to start your networking elsewhere. When the download completes, store the items and tell the view to update. Have the numberOfRowsInSection method just return the current number of items, which will initially be zero. Possibly also present some sort of "wait" indication (spinner, etc) in this case.
Mar ’25