Post

Replies

Boosts

Views

Activity

Reply to Install HTTP Live Streaming Tools on Linux ARM
is there a way to run them like Mac OS does with Rosseta? Yes, you can use qemu. If you apt-get install qemu-user qemu-user-binfmt then invoking an x86 executable will use qemu to run it. But there’s a snag - if the executable is dynamically linked, you also need the x86 versions of the libraries that it is linked with. On Debian, this is achieved using ”multiarch”. Of course the performance may not be great! If I were you, I’d work out how to do it using ffmpeg. It’s not fundamentally difficult, though it is somewhat tedious to find all the right incantations.
Topic: Media Technologies SubTopic: Streaming Tags:
Apr ’25
Reply to XCode not making bridging header file?
There are two distinct things here: You can export C or C++ (hmmm objC?) to Swift. You can export Swift to C/C++/ObjC. It looks like you want to do the latter. For that, XCode does generate a header but it’s not the file you are looking at in your source tree. It’s a temporary file deep inside the build / intermediates folder structure. The file you are looking at is for exporting in the other direction - as the comment you quoted says - and you can ignore it. Hopefully that is enough to get you a bit further. You may find previous discussions here if you search for e.g. “bridging”.
Apr ’25
Reply to Unable to use altitude for our use case (NYC MTA)
These levels typically differ by at least 15 feet, which should in theory be well within the precision range of a properly calibrated barometric pressure sensor. Yes, but… However, the absolute altitude values we’re seeing from these APIs are often inaccurate and inconsistent … Apple have ”improved“ them for you. If I were you, I’d look at the raw(?) barometric pressure that should be in CMAltitudeData.pressure. See if this is consistent between devices, and has the resolution that you need to determine station levels. If it does, you just need to know current local sea level pressure. You can probably assume that is constant across your area of interest. Have your app get that from your servers every hour, or whatever. (Out of interest, are the barometric pressures in underground stations affected by the piston effect of the moving trains enough to perturb this analysis?)
Apr ’25
Reply to Class not being called?
please could you explain why does creating the instance of API not work as a global Maybe it does work. You don’t see your “line 25” because you didn’t call resume() and the download never happened. Maybe the object was constructed, we don’t know. The point is that it shouldn‘t be a global because that’s a bad design, not because it won’t work.
Mar ’25
Reply to Why does Array's contains(_:) method cause an error when comparing an optional value with a non-optional value in Swift?
Why does the first example work I don’t know. but the second one fails with a compile-time error? What exactly causes this error in the second case, even though both cases involve comparing an optional value with a non-optional value? The declaration of contains that you posted shows that it takes an Element. Element is String. If you don’t pass a String, you’ll get an error. (The fact that it calls another contains method that would work with the optional doesn’t matter; it doesn’t get that far. You could argue that contains should not take an Element but rather an equality-comparable-with-Element; I think that’s possible.) Does contains(_:) behave differently when used with an explicit array variable rather than a direct array literal? If so, why? My guess is that by some magic the type of the array literal is determined to be an array of optional strings, but that really is just a guess.
Topic: Programming Languages SubTopic: Swift Tags:
Mar ’25
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