Post

Replies

Boosts

Views

Activity

Reply to How do I stop Tasks from choking up animations?
Thanks for the prompt response! I managed to solve the issue after doing all the things I've avoided doing out of laziness and drilling deep into my code, and then realizing that my implementation of the animation was either the root cause or a major contributor Uninteresting post-mortem I excised all state for the loading screen into its own view model, granting me more control over its concurrency. I then designated the animation function @MainActor and the workload nonisolated (I'm a terrible person) These failed to solve the issue, so after jiggling a lot of knobs I drilled deep into the workload code This yielded a function that ran on @MainActor deep into the code, so I fixed that and the issue still wasn't fixed. More knobs were jiggled, no help Realized the animation itself was poorly implemented since I wrote that when I was very new to coding Long story short There's a beachball-like image that rotates 360 degrees during loading, but back then I didn't know about .repeatForever(), so instead I jury rigged an abomination: Task { while loading { try await Task.sleep(for: .seconds(0.5)) withAnimation(.linear(duration: 0.5)) { beachballRotation += 90 } } } The issues went away after replacing all that with: withAnimation(.linear(duration: 2).repeatForever(autoreverses: false)) { beachballRotation = 360 } The animation still jumps at the 360 degree mark, when the animation repeats itself. Other than that, everything works smoothly, so I'm sure I'll eventually figure something out. I bet moving everything to a view model and setting the workload to nonisolated also helped (again, I'm a terrible person and I'm sorry). My guess is timing imperfections + frequent new calls during heavy load processing lead to the sputtering and freezing. But all of this has reminded me of a question I've always had: In the process of moving to nonisolated, I've had to disfigure my code by inserting DispatchQueue.main.async closures. This is my go-to solution whenever a purple or yellow warning pops up telling me some async code should be on the main thread. But, every time I do this, there's a little voice at the back of my head reminding me of a warning a younger me received about never crossing the streams. i.e. One should never mix the antiquated DispatchQueue.main.async/GCD with the modern async-await. I'm a SwiftUI native, and all my concurrency is technically async-await. At last count I have 150 instances where I've crossed the streams. Many of these were done out of desperation because my app makes heavy use of SpriteKit, whose SKScene demands all calls to be on the main queue. Everything seems to work fine for now, but this is still something I'd like to fix before it blows up in my face or Apple finally makes it a bona-fide error. tl;dr - How does one avoid using DispatchQueue.main.async to encapsulate async-await code that should be on main? @DTS Engineer if you feel this deserves its own thread, please let me know and I'll make one.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Jul ’24
Reply to How to attribute/credit Apple Fonts added to app?
@mikestern Thanks to you, I managed to dodge a bullet. For posterity, I'll post a short write-up of my findings (Jul. 10, 2024). Long story short, I assumed that fonts included in macOS are all free to use in apps for the Apple ecosystem, but your answer prompted me to double check that assumption. Warning: I am not a laywer, and this is not legal advice Usage of the fonts included in macOS' FontBook are governed by the macOS Sonoma Licensing Agreement, then by the embedding restrictions and licenses set forth by the actual creators of the font. On page 3, under Section 1: E. Fonts. Subject to the terms and conditions of this License, you may use the fonts included with the Apple Software to display and print content while running the Apple Software; however, you may only embed fonts in content if that is permitted by the embedding restrictions accompanying the font in question. These embedding restrictions can be found in the Font Book/Preview/Show Font Info panel. The word "embedding" is key here. In similar contexts elsewhere, the word implies non-interactive uses like in posters or a document, and typically excludes apps. It would be safer to assume this also holds true here. This means one should instead look to the font's licensing information, which can also be found by opening FontBook and opening the info panel (Cmd + I) and looking under "Usage". Many of the fonts have restrictive licenses, and among these are the SF family of fonts. These fonts, despite being the default font used in iOS app development, cannot be included as individual fonts in the app. It would be mind-bogglingly counterproductive for Apple to place the system font under a license that disallows developers from including it in their apps, so I can safely assume that one variant can be used via the system font, just as you said Absent actual legal advice, I would play it safe and avoid all FontBook fonts except those with a license explicitly allowing commercial use, such as the SIL Open Font License. A safer repository of fonts would be Google Fonts, where the vast majority of fonts are under SIL or Apache.
Topic: Design SubTopic: General Tags:
Jul ’24
Reply to Compiling the JPEG-XL reference for iOS, or, "Is compiling C++ for iOS really this difficult!?"
I managed to get JXL working after a lot of angst and grit. I didn't have C++ compilation experience but I managed to get the job done, so this might be encouragement for anyone stuck in a similar situation (no guarantees though). Anyone interested in JXL for iOS should be able to replicate what I did via this thread: https://developer.apple.com/forums/thread/757359
Jun ’24
Reply to Reducing storage of similar PNGs by compressing them into a video and retrieving them losslessly--possibility or dumb idea?
wmk's Misadventures in Compiling C++, Finale (?) JXL is working on my iPhone after I got rid of libjpegli. The weeklong tumble down the rabbit hole of C++ compilation is finally over; and thus ends this impromptu blog I started writing for debugging purposes and to keep myself sane. At the end of this I look back and realize how much I've been spoiled by Xcode, where compiling is just a mindless habit. Having to figure out CMake after being raised on Xcode is like getting chucked into the slums after having lived all your life in an ivory tower being pampered by servants who aren't perfect, but get the job done. I've done some preliminary tests on encoding, decoding, and animation and everything seems to be working fine. The code in https://github.com/awxkee/jxl-coder-swift works even with TaskGroups, which allows me to turbocharge everything. JXL so far seems to be absolutely worth the effort. Now I just need to fiddle with the parameters to optimize performance for my app, and actually examine the animation output. @endecotp I cannot thank you enough for introducing me to JXL and sticking with me until I got it working. I was about to spend perhaps hundreds of dollars, but in the end all I spent was $2.99 on an Upwork job post. If the opportunity ever arises, I'd definitely return the favor. P.S. Upwork is a dumpster fire.
Topic: Media Technologies SubTopic: Video Tags:
Jun ’24
Reply to Reducing storage of similar PNGs by compressing them into a video and retrieving them losslessly--possibility or dumb idea?
That's probably it, given how touchy CMake seems to be I'm currently stuck because I can't get jpegli to compile, and apparently its wired into the package. It just absolutely refuses to be compiled. I suspect it has something to do with -- Could NOT find JPEG (missing: JPEG_LIBRARY JPEG_INCLUDE_DIR) But I don't know where to begin because, while installing libjpeg-turbo on this would probably lead to the warning going away, it would likely lead to cross-compiling issues (that thing Quinn was talking about). Apparently I'm not the only one with issues compiling jpegli: https://github.com/libjxl/libjxl/issues/3440 I've also tried a slew of different hacks, including isolating it and forcing it to compile, but I'm stuck on this error: CMake Error at jpegli.cmake:46 (target_link_libraries): Target "jpegli-static" links to: Threads::Threads but the target was not found. Possible reasons include: * There is a typo in the target name. * A find_package call is missing for an IMPORTED target. * An ALIAS target is missing. Anyways, I'll figure something out, like precisely excising it from libjxl
Topic: Media Technologies SubTopic: Video Tags:
Jun ’24
Reply to Reducing storage of similar PNGs by compressing them into a video and retrieving them losslessly--possibility or dumb idea?
wmk's Misadventures in Compiling C++, Episode 2 After a break, it became apparent that tools had to be purged from the process entirely. This was accomplished by removing add_subdirectory(tools) from the main CMakeLists.txt. [ 73%] Linking CXX executable tests/codec_test.app/tests/codec_test ld: open() failed, errno=2 for 'tests/codec_test.app/tests/codec_test' clang: error: linker command failed with exit code 1 (use -v to see invocation) make[2]: *** [lib/tests/codec_test.app/tests/codec_test] Error 1 make[1]: *** [lib/CMakeFiles/codec_test.dir/all] Error 2 make: *** [all] Error 2 I'm finally back to where I started--question now is why this is being built at all. Since I made progress by removing a part of the main CMakeLists.txt, I decided to go all-in and started hacking away entire sections of the file like I was chopping a piece of wood. So this is why they call it "hacking". My mental image of a hacker became a bit more like a lumberjack. Everything below if (JPEGXL_ENABLE_MANPAGES) was hacked off. This means no testing, but at this point I was willing to accept this tradeoff just to see some progress. The result was counterintuitive: we're back to ld: unknown options: --exclude-libs=ALL at a dylib. It was here I realized just how finnicky CMake is and restarted my mac. Starting with a fresh ios-cmake and libjxl, I went through all the steps again, removing the bottom chunk of CMakeLists.txt. Success! [ 95%] Built target jxl_enc-obj [ 95%] Linking CXX static library libjxl_dec-internal.a [ 95%] Built target jxl_dec-internal [ 96%] Linking CXX static library libjxl-internal.a [ 96%] Built target jxl-internal [ 96%] Linking CXX static library libjxl.a [ 96%] Built target jxl [ 97%] Linking CXX static library libjxl_dec.a [ 97%] Built target jxl_dec [ 98%] Building CXX object lib/CMakeFiles/jxl_threads.dir/threads/resizable_parallel_runner.cc.o [ 98%] Building CXX object lib/CMakeFiles/jxl_threads.dir/threads/thread_parallel_runner.cc.o [100%] Building CXX object lib/CMakeFiles/jxl_threads.dir/threads/thread_parallel_runner_internal.cc.o [100%] Linking CXX static library libjxl_threads.a [100%] Built target jxl_threads Now to see whether this is a stillbirth, an abomination, or a little angel that poops out JXL. My expectations are low; what I've done so far is trivial, especially for a professional, and we do have a professional working at TikTok's parent company saying, "This coder does not supports JPEG-XL encoding (Because I have no time :))",. The adventure continues...
Topic: Media Technologies SubTopic: Video Tags:
Jun ’24
Reply to Reducing storage of similar PNGs by compressing them into a video and retrieving them losslessly--possibility or dumb idea?
Thank you so very much. In the interim I had already opened an account on Upwork, waded through LLM spam and grifters, found someone willing to do it for $150, had money persistently rejected by Upwork, found its support intentionally disabled, then closed my account (takeaway: Upwork is a dumpster fire). That was 6 hours down the drain. In comparison, this is a godsend, even if I might need to put in some work myself wmk's Misadventures in Compiling C++, Episode 1 I used to get around the install TARGETS given no BUNDLE DESTINATION error by adding BUNDLE DESTINATION after RUNTIME DESTINATION but I had to do it for tools/CMakeLists.txt as well. I cleared everything and followed your instructions from scratch, verbatim. My first attempt after git cloning and modifying the brotli/CMakeLists.txt, I was getting the error: CMake Error at tools/CMakeLists.txt:340 (install): install TARGETS given no BUNDLE DESTINATION for MACOSX_BUNDLE executable target "cjxl". Maybe your invocation was supposed to disable the building of tools, so I double-checked that mine's a verbatim copy of yours (it was) and considered whether your libjxl might be older. Since it seems tools was still being built for some reason, I appended the following to your command: -DJPEGXL_ENABLE_DEVTOOLS=false \ -DJPEGXL_ENABLE_VIEWERS=false \ -DJPEGXL_ENABLE_PLUGINS=false \ -DJPEGXL_TEST_TOOLS=false \ -DJPEGXL_STATIC=true Same error. So I applied your fix by removing the offending install call from tools/CMakeLists.txt and reverted to your original command. The config succeeds but always has zsh: no such file or directory: -DCMAKE_INSTALL_PREFIX=/Users/username/Desktop/compiled at the end (Note: I clear build.ios between every attempt). I then ran make: [ 61%] Linking CXX executable tests/codec_test.app/tests/codec_test ld: open() failed, errno=2 for 'tests/codec_test.app/tests/codec_test' clang: error: linker command failed with exit code 1 (use -v to see invocation) make[2]: *** [lib/tests/codec_test.app/tests/codec_test] Error 1 make[1]: *** [lib/CMakeFiles/codec_test.dir/all] Error 2 make: *** [all] Error 2 Little did I know, I'll be yearning to see this error in an hour. I saw "executable" and "test" and realized it was still compiling executables for tests, so I went back and added the extra flags above, then ran make again. [ 20%] Linking CXX shared library libjxl_dec.dylib ld: unknown options: --exclude-libs=ALL clang: error: linker command failed with exit code 1 (use -v to see invocation) make[2]: *** [lib/libjxl_dec.0.10.2.dylib] Error 1 make[1]: *** [lib/CMakeFiles/jxl_dec.dir/all] Error 2 make: *** [all] Error 2 Why is it building a dylib? Is there an issue with the flags? I tried variations of the invocation your flags + -DJPEGXL_STATIC=true: Same error I decided to give your vanilla command another try: Same error? Clearly some state is being saved somewhere, so I wiped the entire libjxl folder and copied in the untouched original, then reapplied CMakeLists.txt changes: Still the same error!? This was where grand attempt 1 was reset since I was stuck with the dylib error (I'm writing this log as I retrace my steps with grand attempt 2) I tried various changes, including retracing my precise steps above, but I couldn't return to the previous error. I suspected CMake has some sort of cache/state set somewhere, so I looked online, found nothing, then did what any good techie did and reset my mac. Still there. Grand attempt 3 was basically the same except I never saw ld: open() failed, errno=2 . env: macOS 14.5, CMake 3.29.6 The adventure continues...
Topic: Media Technologies SubTopic: Video Tags:
Jun ’24
Reply to Reducing storage of similar PNGs by compressing them into a video and retrieving them losslessly--possibility or dumb idea?
I don't know what I'm doing, so I'm using -G Xcode simply because that's what's in the ios-cmake toolchain example. I took your advice and looked for flags to set, and this is my new cmake invocation (tl;dr everything off except static flag, which invokes -DBUILD_SHARED_LIBS=OFF and required files): cmake -B build \ -DJPEGXL_ENABLE_FUZZERS=OFF \ -DJPEGXL_ENABLE_DEVTOOLS=OFF \ -DJPEGXL_ENABLE_TOOLS=OFF \ -DJPEGXL_ENABLE_JPEGLI=OFF \ -DJPEGXL_INSTALL_JPEGLI_LIBJPEG=OFF \ -DJPEGXL_ENABLE_DOXYGEN=OFF \ -DJPEGXL_ENABLE_BENCHMARK=OFF \ -DJPEGXL_ENABLE_EXAMPLES=OFF \ -DJPEGXL_BUNDLE_LIBPNG=OFF \ -DJPEGXL_ENABLE_JNI=OFF \ -DJPEGXL_ENABLE_SJPEG=OFF \ -DJPEGXL_ENABLE_OPENEXR=OFF \ -DJPEGXL_ENABLE_SKCMS=ON \ -DJPEGXL_ENABLE_VIEWERS=OFF \ -DJPEGXL_ENABLE_PLUGINS=OFF \ -DJPEGXL_ENABLE_COVERAGE=OFF \ -DJPEGXL_ENABLE_TRANSCODE_JPEG=OFF \ -DJPEGXL_STATIC=ON \ -DJPEGXL_TEST_TOOLS=OFF \ -DJPEGXL_ENABLE_AVX512=OFF \ -DJPEGXL_ENABLE_AVX512_SPR=OFF \ -DJPEGXL_ENABLE_AVX512_ZEN4=OFF \ -DJPEGXL_FORCE_SYSTEM_BROTLI=OFF \ -DJPEGXL_FORCE_SYSTEM_GTEST=ON \ -DJPEGXL_FORCE_SYSTEM_LCMS2=ON \ -DJPEGXL_FORCE_SYSTEM_HWY=OFF \ -DBUILD_SHARED_LIBS=OFF \ -DCMAKE_TOOLCHAIN_FILE=../../ios.toolchain.cmake \ -DPLATFORM=OS64 \ -DCMAKE_BUILD_TYPE=Release \ -DBUILD_TESTING=OFF .. With -G Xcode I'm back to the same errors as above with highway and brotli, which means this is a dependency issue even with flags set. Without it, I get the following error: [ 6%] Linking CXX executable hwy_list_targets.app/hwy_list_targets ld: library not found for -lcrt0.o clang: error: linker command failed with exit code 1 (use -v to see invocation) make[2]: *** [third_party/highway/hwy_list_targets.app/hwy_list_targets] Error 1 make[1]: *** [third_party/highway/CMakeFiles/hwy_list_targets.dir/all] Error 2 make: *** [all] Error 2 At this point, I have to say that this has been a learning experience but this is too much to just evaluate whether JXL fits my needs. I need to get back to productive work. Can I make you an offer? If you compiled JXL yourself so it works on your iOS runtime, with encode/decode and animation functions intact and performant, I will gladly pay you for detailed instructions on how to replicate your success, and also a bit more to thank you for your help here and elsewhere. We can discuss the details elsewhere. Note that I'm not asking for a compiled product (security issues), but for the instructions on how to get from the reference repository to iOS runtime with the requested functions.
Topic: Media Technologies SubTopic: Video Tags:
Jun ’24
Reply to Reducing storage of similar PNGs by compressing them into a video and retrieving them losslessly--possibility or dumb idea?
[quote='791764022, endecotp, /thread/757359?answerId=791764022#791764022, /profile/endecotp'] I do include it in my iOS app at runtime. Doing so was not a particularly easy process. I used something from github called "ios-cmake", which is a pile of scripts and/or cmake configuration fragments. 0  comments [/quote] I'm experiencing first-hand how uneasy this is. Especially since I'm new to CMake. I was able to prepare the compile after making minor adjustments to the CMakeLists.txt files of outdated dependencies, but after that I've been unable to do the actual build process using ios-cmake due to errors cmake -B build -G Xcode -DCMAKE_TOOLCHAIN_FILE=../../ios.toolchain.cmake -DPLATFORM=OS64 -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=OFF .. cmake --build . --config Release Yields the error ** BUILD FAILED ** The following build commands failed: Ld /Users/username/Desktop/libjxl-main/build/build/lib/Release-iphoneos/libjxl_cms.0.10.2.dylib normal (in target 'jxl_cms' from project 'LIBJXL') (1 failure) It feels like I'm close, but I can't even gauge whether I'm close to figuring this out or whether I'm actually miles away--there's much uncertainty when you're new to something.
Topic: Media Technologies SubTopic: Video Tags:
Jun ’24
Reply to Is the issue of code-theft via decompilation or reverse engineering common for Swift iOS apps? And can I protect a small portion of my code?
@CMDdev Yeah that’s true, the key would be protected (I was talking about protecting process memory, not your idea of encrypting assets). Most of that paragraph was me not reading your post closely enough and just ranting on. My apologies. I agree with your general point that even with memory encryption, the jailbroken state of the device means the memory might not be safe, though I'd say that if implemented, memory keys would likely be stored in something akin to a secure enclave. Anyways I'll add as many pieces of Swiss cheese to my defenses as my time, ability, and the app's performance allows. Anything to slow down the competition.
Topic: Privacy & Security SubTopic: General Tags:
Jun ’24
Reply to Reducing storage of similar PNGs by compressing them into a video and retrieving them losslessly--possibility or dumb idea?
@endecotp If something builds for arm64 macOS, shouldn't it work with iOS/iPadOS, which is also arm64? Anyways, I might have misunderstood you earlier--are you saying you use libjxl during development but don't include it as part of your runtime? Because I thought you included it and that making libjxl work on iOS is an easy/supported process. I'm scratching my head trying to figure out how to compile libjxl to include in my binary but the more I look at the problem, the more it seems like this is far more than what a complete novice at cmake should even attempt, especially when a professional says "This coder does not supports JPEG-XL encoding (Because I have no time :))" Looks like I need to go back to using video as storage, or maybe try AVIF/webp/jpeg2000
Topic: Media Technologies SubTopic: Video Tags:
Jun ’24
Reply to Is the issue of code-theft via decompilation or reverse engineering common for Swift iOS apps? And can I protect a small portion of my code?
[quote='791426022, endecotp, /thread/757255?answerId=791426022#791426022, /profile/endecotp'] With your scheme, make sure you test what happens when a user gets a new device and your app is copied over automatically for them. [/quote] This is a really good point I haven't thought of. Looks like I'll either have to delete everything (with explanation) or have some way of detecting a transfer and then re-encrypting. Without transfer detection this re-encryption mechanism can be abused. @CMDdev one already has broad access in a jailbroken phone, and that might include access to this hypothetical process memory decryption key I'm fairly sure the enclave key never leaves the enclave and therefore can't be intercepted unless the enclave itself was somehow compromised, but I think a compromised enclave and its implications would mean Apple's whole security model is broken. The attackers not being able to get a key doesn't matter if everything the key is meant to protect can be captured via memory. Moreover, enclave keys should only be a portion of all types of keys, with many needing to stay in memory--are they all vulnerable? I don't think Apple security engineers are fools; I think we might be missing something if decrypted memory capture really is as simple as it sounds. Yes, but also, even if it isn't the first one, there could be reasons why that app is better. First one might not necessarily be the best one. This also applies to most Apple hardware, which tend not to be the first of their kind but (usually) the most well-executed. P.S. Turns out the word "nuk.e" (sans period) is censored. I don't get it.
Topic: Privacy & Security SubTopic: General Tags:
Jun ’24
Reply to Reducing storage of similar PNGs by compressing them into a video and retrieving them losslessly--possibility or dumb idea?
@endecotp Thank you. I'm going to try to compile it for iOS and then incorporate wrappers around it. So much to learn, so little time. Does the build instructions in the docs work for iOS/arm? cd libjxl mkdir build cd build cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=OFF .. cmake --build . -- -j$(nproc)
Topic: Media Technologies SubTopic: Video Tags:
Jun ’24
Reply to Reducing storage of similar PNGs by compressing them into a video and retrieving them losslessly--possibility or dumb idea?
@endecotp I did some reading on JXL and it looks promising. The format seems to have some inter-frame compression for animation, which might be what I'm looking for. On top of that the encode/decode speed seems good, but that depends on how well the iOS implementation runs. I need to run tests. What do you use to incorporate JXL into your iOS projects? Unless something is by a trusted or official source, I have to go through every single line, which means something like https://github.com/awxkee/jxl-coder-swift is prohibitively long to get through.
Topic: Media Technologies SubTopic: Video Tags:
Jun ’24
Reply to How do I stop Tasks from choking up animations?
Thanks for the prompt response! I managed to solve the issue after doing all the things I've avoided doing out of laziness and drilling deep into my code, and then realizing that my implementation of the animation was either the root cause or a major contributor Uninteresting post-mortem I excised all state for the loading screen into its own view model, granting me more control over its concurrency. I then designated the animation function @MainActor and the workload nonisolated (I'm a terrible person) These failed to solve the issue, so after jiggling a lot of knobs I drilled deep into the workload code This yielded a function that ran on @MainActor deep into the code, so I fixed that and the issue still wasn't fixed. More knobs were jiggled, no help Realized the animation itself was poorly implemented since I wrote that when I was very new to coding Long story short There's a beachball-like image that rotates 360 degrees during loading, but back then I didn't know about .repeatForever(), so instead I jury rigged an abomination: Task { while loading { try await Task.sleep(for: .seconds(0.5)) withAnimation(.linear(duration: 0.5)) { beachballRotation += 90 } } } The issues went away after replacing all that with: withAnimation(.linear(duration: 2).repeatForever(autoreverses: false)) { beachballRotation = 360 } The animation still jumps at the 360 degree mark, when the animation repeats itself. Other than that, everything works smoothly, so I'm sure I'll eventually figure something out. I bet moving everything to a view model and setting the workload to nonisolated also helped (again, I'm a terrible person and I'm sorry). My guess is timing imperfections + frequent new calls during heavy load processing lead to the sputtering and freezing. But all of this has reminded me of a question I've always had: In the process of moving to nonisolated, I've had to disfigure my code by inserting DispatchQueue.main.async closures. This is my go-to solution whenever a purple or yellow warning pops up telling me some async code should be on the main thread. But, every time I do this, there's a little voice at the back of my head reminding me of a warning a younger me received about never crossing the streams. i.e. One should never mix the antiquated DispatchQueue.main.async/GCD with the modern async-await. I'm a SwiftUI native, and all my concurrency is technically async-await. At last count I have 150 instances where I've crossed the streams. Many of these were done out of desperation because my app makes heavy use of SpriteKit, whose SKScene demands all calls to be on the main queue. Everything seems to work fine for now, but this is still something I'd like to fix before it blows up in my face or Apple finally makes it a bona-fide error. tl;dr - How does one avoid using DispatchQueue.main.async to encapsulate async-await code that should be on main? @DTS Engineer if you feel this deserves its own thread, please let me know and I'll make one.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Jul ’24
Reply to How to attribute/credit Apple Fonts added to app?
@mikestern Thanks to you, I managed to dodge a bullet. For posterity, I'll post a short write-up of my findings (Jul. 10, 2024). Long story short, I assumed that fonts included in macOS are all free to use in apps for the Apple ecosystem, but your answer prompted me to double check that assumption. Warning: I am not a laywer, and this is not legal advice Usage of the fonts included in macOS' FontBook are governed by the macOS Sonoma Licensing Agreement, then by the embedding restrictions and licenses set forth by the actual creators of the font. On page 3, under Section 1: E. Fonts. Subject to the terms and conditions of this License, you may use the fonts included with the Apple Software to display and print content while running the Apple Software; however, you may only embed fonts in content if that is permitted by the embedding restrictions accompanying the font in question. These embedding restrictions can be found in the Font Book/Preview/Show Font Info panel. The word "embedding" is key here. In similar contexts elsewhere, the word implies non-interactive uses like in posters or a document, and typically excludes apps. It would be safer to assume this also holds true here. This means one should instead look to the font's licensing information, which can also be found by opening FontBook and opening the info panel (Cmd + I) and looking under "Usage". Many of the fonts have restrictive licenses, and among these are the SF family of fonts. These fonts, despite being the default font used in iOS app development, cannot be included as individual fonts in the app. It would be mind-bogglingly counterproductive for Apple to place the system font under a license that disallows developers from including it in their apps, so I can safely assume that one variant can be used via the system font, just as you said Absent actual legal advice, I would play it safe and avoid all FontBook fonts except those with a license explicitly allowing commercial use, such as the SIL Open Font License. A safer repository of fonts would be Google Fonts, where the vast majority of fonts are under SIL or Apache.
Topic: Design SubTopic: General Tags:
Replies
Boosts
Views
Activity
Jul ’24
Reply to Compiling the JPEG-XL reference for iOS, or, "Is compiling C++ for iOS really this difficult!?"
I managed to get JXL working after a lot of angst and grit. I didn't have C++ compilation experience but I managed to get the job done, so this might be encouragement for anyone stuck in a similar situation (no guarantees though). Anyone interested in JXL for iOS should be able to replicate what I did via this thread: https://developer.apple.com/forums/thread/757359
Replies
Boosts
Views
Activity
Jun ’24
Reply to Reducing storage of similar PNGs by compressing them into a video and retrieving them losslessly--possibility or dumb idea?
wmk's Misadventures in Compiling C++, Finale (?) JXL is working on my iPhone after I got rid of libjpegli. The weeklong tumble down the rabbit hole of C++ compilation is finally over; and thus ends this impromptu blog I started writing for debugging purposes and to keep myself sane. At the end of this I look back and realize how much I've been spoiled by Xcode, where compiling is just a mindless habit. Having to figure out CMake after being raised on Xcode is like getting chucked into the slums after having lived all your life in an ivory tower being pampered by servants who aren't perfect, but get the job done. I've done some preliminary tests on encoding, decoding, and animation and everything seems to be working fine. The code in https://github.com/awxkee/jxl-coder-swift works even with TaskGroups, which allows me to turbocharge everything. JXL so far seems to be absolutely worth the effort. Now I just need to fiddle with the parameters to optimize performance for my app, and actually examine the animation output. @endecotp I cannot thank you enough for introducing me to JXL and sticking with me until I got it working. I was about to spend perhaps hundreds of dollars, but in the end all I spent was $2.99 on an Upwork job post. If the opportunity ever arises, I'd definitely return the favor. P.S. Upwork is a dumpster fire.
Topic: Media Technologies SubTopic: Video Tags:
Replies
Boosts
Views
Activity
Jun ’24
Reply to Reducing storage of similar PNGs by compressing them into a video and retrieving them losslessly--possibility or dumb idea?
That's probably it, given how touchy CMake seems to be I'm currently stuck because I can't get jpegli to compile, and apparently its wired into the package. It just absolutely refuses to be compiled. I suspect it has something to do with -- Could NOT find JPEG (missing: JPEG_LIBRARY JPEG_INCLUDE_DIR) But I don't know where to begin because, while installing libjpeg-turbo on this would probably lead to the warning going away, it would likely lead to cross-compiling issues (that thing Quinn was talking about). Apparently I'm not the only one with issues compiling jpegli: https://github.com/libjxl/libjxl/issues/3440 I've also tried a slew of different hacks, including isolating it and forcing it to compile, but I'm stuck on this error: CMake Error at jpegli.cmake:46 (target_link_libraries): Target "jpegli-static" links to: Threads::Threads but the target was not found. Possible reasons include: * There is a typo in the target name. * A find_package call is missing for an IMPORTED target. * An ALIAS target is missing. Anyways, I'll figure something out, like precisely excising it from libjxl
Topic: Media Technologies SubTopic: Video Tags:
Replies
Boosts
Views
Activity
Jun ’24
Reply to Reducing storage of similar PNGs by compressing them into a video and retrieving them losslessly--possibility or dumb idea?
wmk's Misadventures in Compiling C++, Episode 2 After a break, it became apparent that tools had to be purged from the process entirely. This was accomplished by removing add_subdirectory(tools) from the main CMakeLists.txt. [ 73%] Linking CXX executable tests/codec_test.app/tests/codec_test ld: open() failed, errno=2 for 'tests/codec_test.app/tests/codec_test' clang: error: linker command failed with exit code 1 (use -v to see invocation) make[2]: *** [lib/tests/codec_test.app/tests/codec_test] Error 1 make[1]: *** [lib/CMakeFiles/codec_test.dir/all] Error 2 make: *** [all] Error 2 I'm finally back to where I started--question now is why this is being built at all. Since I made progress by removing a part of the main CMakeLists.txt, I decided to go all-in and started hacking away entire sections of the file like I was chopping a piece of wood. So this is why they call it "hacking". My mental image of a hacker became a bit more like a lumberjack. Everything below if (JPEGXL_ENABLE_MANPAGES) was hacked off. This means no testing, but at this point I was willing to accept this tradeoff just to see some progress. The result was counterintuitive: we're back to ld: unknown options: --exclude-libs=ALL at a dylib. It was here I realized just how finnicky CMake is and restarted my mac. Starting with a fresh ios-cmake and libjxl, I went through all the steps again, removing the bottom chunk of CMakeLists.txt. Success! [ 95%] Built target jxl_enc-obj [ 95%] Linking CXX static library libjxl_dec-internal.a [ 95%] Built target jxl_dec-internal [ 96%] Linking CXX static library libjxl-internal.a [ 96%] Built target jxl-internal [ 96%] Linking CXX static library libjxl.a [ 96%] Built target jxl [ 97%] Linking CXX static library libjxl_dec.a [ 97%] Built target jxl_dec [ 98%] Building CXX object lib/CMakeFiles/jxl_threads.dir/threads/resizable_parallel_runner.cc.o [ 98%] Building CXX object lib/CMakeFiles/jxl_threads.dir/threads/thread_parallel_runner.cc.o [100%] Building CXX object lib/CMakeFiles/jxl_threads.dir/threads/thread_parallel_runner_internal.cc.o [100%] Linking CXX static library libjxl_threads.a [100%] Built target jxl_threads Now to see whether this is a stillbirth, an abomination, or a little angel that poops out JXL. My expectations are low; what I've done so far is trivial, especially for a professional, and we do have a professional working at TikTok's parent company saying, "This coder does not supports JPEG-XL encoding (Because I have no time :))",. The adventure continues...
Topic: Media Technologies SubTopic: Video Tags:
Replies
Boosts
Views
Activity
Jun ’24
Reply to Compiling the JPEG-XL reference for iOS, or, "Is compiling C++ for iOS really this difficult!?"
Just knowing something is out of my league makes things so much better. At least I won't be pestering people for help while thinking it's a quick and simple task.
Replies
Boosts
Views
Activity
Jun ’24
Reply to Reducing storage of similar PNGs by compressing them into a video and retrieving them losslessly--possibility or dumb idea?
Thank you so very much. In the interim I had already opened an account on Upwork, waded through LLM spam and grifters, found someone willing to do it for $150, had money persistently rejected by Upwork, found its support intentionally disabled, then closed my account (takeaway: Upwork is a dumpster fire). That was 6 hours down the drain. In comparison, this is a godsend, even if I might need to put in some work myself wmk's Misadventures in Compiling C++, Episode 1 I used to get around the install TARGETS given no BUNDLE DESTINATION error by adding BUNDLE DESTINATION after RUNTIME DESTINATION but I had to do it for tools/CMakeLists.txt as well. I cleared everything and followed your instructions from scratch, verbatim. My first attempt after git cloning and modifying the brotli/CMakeLists.txt, I was getting the error: CMake Error at tools/CMakeLists.txt:340 (install): install TARGETS given no BUNDLE DESTINATION for MACOSX_BUNDLE executable target "cjxl". Maybe your invocation was supposed to disable the building of tools, so I double-checked that mine's a verbatim copy of yours (it was) and considered whether your libjxl might be older. Since it seems tools was still being built for some reason, I appended the following to your command: -DJPEGXL_ENABLE_DEVTOOLS=false \ -DJPEGXL_ENABLE_VIEWERS=false \ -DJPEGXL_ENABLE_PLUGINS=false \ -DJPEGXL_TEST_TOOLS=false \ -DJPEGXL_STATIC=true Same error. So I applied your fix by removing the offending install call from tools/CMakeLists.txt and reverted to your original command. The config succeeds but always has zsh: no such file or directory: -DCMAKE_INSTALL_PREFIX=/Users/username/Desktop/compiled at the end (Note: I clear build.ios between every attempt). I then ran make: [ 61%] Linking CXX executable tests/codec_test.app/tests/codec_test ld: open() failed, errno=2 for 'tests/codec_test.app/tests/codec_test' clang: error: linker command failed with exit code 1 (use -v to see invocation) make[2]: *** [lib/tests/codec_test.app/tests/codec_test] Error 1 make[1]: *** [lib/CMakeFiles/codec_test.dir/all] Error 2 make: *** [all] Error 2 Little did I know, I'll be yearning to see this error in an hour. I saw "executable" and "test" and realized it was still compiling executables for tests, so I went back and added the extra flags above, then ran make again. [ 20%] Linking CXX shared library libjxl_dec.dylib ld: unknown options: --exclude-libs=ALL clang: error: linker command failed with exit code 1 (use -v to see invocation) make[2]: *** [lib/libjxl_dec.0.10.2.dylib] Error 1 make[1]: *** [lib/CMakeFiles/jxl_dec.dir/all] Error 2 make: *** [all] Error 2 Why is it building a dylib? Is there an issue with the flags? I tried variations of the invocation your flags + -DJPEGXL_STATIC=true: Same error I decided to give your vanilla command another try: Same error? Clearly some state is being saved somewhere, so I wiped the entire libjxl folder and copied in the untouched original, then reapplied CMakeLists.txt changes: Still the same error!? This was where grand attempt 1 was reset since I was stuck with the dylib error (I'm writing this log as I retrace my steps with grand attempt 2) I tried various changes, including retracing my precise steps above, but I couldn't return to the previous error. I suspected CMake has some sort of cache/state set somewhere, so I looked online, found nothing, then did what any good techie did and reset my mac. Still there. Grand attempt 3 was basically the same except I never saw ld: open() failed, errno=2 . env: macOS 14.5, CMake 3.29.6 The adventure continues...
Topic: Media Technologies SubTopic: Video Tags:
Replies
Boosts
Views
Activity
Jun ’24
Reply to Reducing storage of similar PNGs by compressing them into a video and retrieving them losslessly--possibility or dumb idea?
I don't know what I'm doing, so I'm using -G Xcode simply because that's what's in the ios-cmake toolchain example. I took your advice and looked for flags to set, and this is my new cmake invocation (tl;dr everything off except static flag, which invokes -DBUILD_SHARED_LIBS=OFF and required files): cmake -B build \ -DJPEGXL_ENABLE_FUZZERS=OFF \ -DJPEGXL_ENABLE_DEVTOOLS=OFF \ -DJPEGXL_ENABLE_TOOLS=OFF \ -DJPEGXL_ENABLE_JPEGLI=OFF \ -DJPEGXL_INSTALL_JPEGLI_LIBJPEG=OFF \ -DJPEGXL_ENABLE_DOXYGEN=OFF \ -DJPEGXL_ENABLE_BENCHMARK=OFF \ -DJPEGXL_ENABLE_EXAMPLES=OFF \ -DJPEGXL_BUNDLE_LIBPNG=OFF \ -DJPEGXL_ENABLE_JNI=OFF \ -DJPEGXL_ENABLE_SJPEG=OFF \ -DJPEGXL_ENABLE_OPENEXR=OFF \ -DJPEGXL_ENABLE_SKCMS=ON \ -DJPEGXL_ENABLE_VIEWERS=OFF \ -DJPEGXL_ENABLE_PLUGINS=OFF \ -DJPEGXL_ENABLE_COVERAGE=OFF \ -DJPEGXL_ENABLE_TRANSCODE_JPEG=OFF \ -DJPEGXL_STATIC=ON \ -DJPEGXL_TEST_TOOLS=OFF \ -DJPEGXL_ENABLE_AVX512=OFF \ -DJPEGXL_ENABLE_AVX512_SPR=OFF \ -DJPEGXL_ENABLE_AVX512_ZEN4=OFF \ -DJPEGXL_FORCE_SYSTEM_BROTLI=OFF \ -DJPEGXL_FORCE_SYSTEM_GTEST=ON \ -DJPEGXL_FORCE_SYSTEM_LCMS2=ON \ -DJPEGXL_FORCE_SYSTEM_HWY=OFF \ -DBUILD_SHARED_LIBS=OFF \ -DCMAKE_TOOLCHAIN_FILE=../../ios.toolchain.cmake \ -DPLATFORM=OS64 \ -DCMAKE_BUILD_TYPE=Release \ -DBUILD_TESTING=OFF .. With -G Xcode I'm back to the same errors as above with highway and brotli, which means this is a dependency issue even with flags set. Without it, I get the following error: [ 6%] Linking CXX executable hwy_list_targets.app/hwy_list_targets ld: library not found for -lcrt0.o clang: error: linker command failed with exit code 1 (use -v to see invocation) make[2]: *** [third_party/highway/hwy_list_targets.app/hwy_list_targets] Error 1 make[1]: *** [third_party/highway/CMakeFiles/hwy_list_targets.dir/all] Error 2 make: *** [all] Error 2 At this point, I have to say that this has been a learning experience but this is too much to just evaluate whether JXL fits my needs. I need to get back to productive work. Can I make you an offer? If you compiled JXL yourself so it works on your iOS runtime, with encode/decode and animation functions intact and performant, I will gladly pay you for detailed instructions on how to replicate your success, and also a bit more to thank you for your help here and elsewhere. We can discuss the details elsewhere. Note that I'm not asking for a compiled product (security issues), but for the instructions on how to get from the reference repository to iOS runtime with the requested functions.
Topic: Media Technologies SubTopic: Video Tags:
Replies
Boosts
Views
Activity
Jun ’24
Reply to Reducing storage of similar PNGs by compressing them into a video and retrieving them losslessly--possibility or dumb idea?
[quote='791764022, endecotp, /thread/757359?answerId=791764022#791764022, /profile/endecotp'] I do include it in my iOS app at runtime. Doing so was not a particularly easy process. I used something from github called "ios-cmake", which is a pile of scripts and/or cmake configuration fragments. 0  comments [/quote] I'm experiencing first-hand how uneasy this is. Especially since I'm new to CMake. I was able to prepare the compile after making minor adjustments to the CMakeLists.txt files of outdated dependencies, but after that I've been unable to do the actual build process using ios-cmake due to errors cmake -B build -G Xcode -DCMAKE_TOOLCHAIN_FILE=../../ios.toolchain.cmake -DPLATFORM=OS64 -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=OFF .. cmake --build . --config Release Yields the error ** BUILD FAILED ** The following build commands failed: Ld /Users/username/Desktop/libjxl-main/build/build/lib/Release-iphoneos/libjxl_cms.0.10.2.dylib normal (in target 'jxl_cms' from project 'LIBJXL') (1 failure) It feels like I'm close, but I can't even gauge whether I'm close to figuring this out or whether I'm actually miles away--there's much uncertainty when you're new to something.
Topic: Media Technologies SubTopic: Video Tags:
Replies
Boosts
Views
Activity
Jun ’24
Reply to Is the issue of code-theft via decompilation or reverse engineering common for Swift iOS apps? And can I protect a small portion of my code?
@CMDdev Yeah that’s true, the key would be protected (I was talking about protecting process memory, not your idea of encrypting assets). Most of that paragraph was me not reading your post closely enough and just ranting on. My apologies. I agree with your general point that even with memory encryption, the jailbroken state of the device means the memory might not be safe, though I'd say that if implemented, memory keys would likely be stored in something akin to a secure enclave. Anyways I'll add as many pieces of Swiss cheese to my defenses as my time, ability, and the app's performance allows. Anything to slow down the competition.
Topic: Privacy & Security SubTopic: General Tags:
Replies
Boosts
Views
Activity
Jun ’24
Reply to Reducing storage of similar PNGs by compressing them into a video and retrieving them losslessly--possibility or dumb idea?
@endecotp If something builds for arm64 macOS, shouldn't it work with iOS/iPadOS, which is also arm64? Anyways, I might have misunderstood you earlier--are you saying you use libjxl during development but don't include it as part of your runtime? Because I thought you included it and that making libjxl work on iOS is an easy/supported process. I'm scratching my head trying to figure out how to compile libjxl to include in my binary but the more I look at the problem, the more it seems like this is far more than what a complete novice at cmake should even attempt, especially when a professional says "This coder does not supports JPEG-XL encoding (Because I have no time :))" Looks like I need to go back to using video as storage, or maybe try AVIF/webp/jpeg2000
Topic: Media Technologies SubTopic: Video Tags:
Replies
Boosts
Views
Activity
Jun ’24
Reply to Is the issue of code-theft via decompilation or reverse engineering common for Swift iOS apps? And can I protect a small portion of my code?
[quote='791426022, endecotp, /thread/757255?answerId=791426022#791426022, /profile/endecotp'] With your scheme, make sure you test what happens when a user gets a new device and your app is copied over automatically for them. [/quote] This is a really good point I haven't thought of. Looks like I'll either have to delete everything (with explanation) or have some way of detecting a transfer and then re-encrypting. Without transfer detection this re-encryption mechanism can be abused. @CMDdev one already has broad access in a jailbroken phone, and that might include access to this hypothetical process memory decryption key I'm fairly sure the enclave key never leaves the enclave and therefore can't be intercepted unless the enclave itself was somehow compromised, but I think a compromised enclave and its implications would mean Apple's whole security model is broken. The attackers not being able to get a key doesn't matter if everything the key is meant to protect can be captured via memory. Moreover, enclave keys should only be a portion of all types of keys, with many needing to stay in memory--are they all vulnerable? I don't think Apple security engineers are fools; I think we might be missing something if decrypted memory capture really is as simple as it sounds. Yes, but also, even if it isn't the first one, there could be reasons why that app is better. First one might not necessarily be the best one. This also applies to most Apple hardware, which tend not to be the first of their kind but (usually) the most well-executed. P.S. Turns out the word "nuk.e" (sans period) is censored. I don't get it.
Topic: Privacy & Security SubTopic: General Tags:
Replies
Boosts
Views
Activity
Jun ’24
Reply to Reducing storage of similar PNGs by compressing them into a video and retrieving them losslessly--possibility or dumb idea?
@endecotp Thank you. I'm going to try to compile it for iOS and then incorporate wrappers around it. So much to learn, so little time. Does the build instructions in the docs work for iOS/arm? cd libjxl mkdir build cd build cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=OFF .. cmake --build . -- -j$(nproc)
Topic: Media Technologies SubTopic: Video Tags:
Replies
Boosts
Views
Activity
Jun ’24
Reply to Reducing storage of similar PNGs by compressing them into a video and retrieving them losslessly--possibility or dumb idea?
@endecotp I did some reading on JXL and it looks promising. The format seems to have some inter-frame compression for animation, which might be what I'm looking for. On top of that the encode/decode speed seems good, but that depends on how well the iOS implementation runs. I need to run tests. What do you use to incorporate JXL into your iOS projects? Unless something is by a trusted or official source, I have to go through every single line, which means something like https://github.com/awxkee/jxl-coder-swift is prohibitively long to get through.
Topic: Media Technologies SubTopic: Video Tags:
Replies
Boosts
Views
Activity
Jun ’24