Dive into the world of programming languages used for app development.

Post

Replies

Boosts

Views

Activity

Applescript seems to run in Rosetta on M2
When calling a perl script from an apple script (by dropping a file on it), I get the error: Can't load '/Library/Perl/5.34/darwin-thread-multi-2level/auto/Encode/Encode.bundle' for module Encode: dlopen(/Library/Perl/5.34/darwin-thread-multi-2level/auto/Encode/Encode.bundle, 0x0001): tried: '/Library/Perl/5.34/darwin-thread-multi-2level/auto/Encode/Encode.bundle' (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64')), '/System/Volumes/Preboot/Cryptexes/OS/Library/Perl/5.34/darwin-thread-multi-2level/auto/Encode/Encode.bundle' (no such file), '/Library/Perl/5.34/darwin-thread-multi-2level/auto/Encode/Encode.bundle' (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64')) at /System/Library/Perl/5.34/XSLoader.pm line 96. at /Library/Perl/5.34/darwin-thread-multi-2level/Encode.pm line 12. When I call the script manually from terminal, it runs fine. Why is Applescript running as X86 on M2?
2
0
414
Sep ’24
NSKeyedUnarchiver.unarchivedObject(ofClass: , from: ) doesn't work with custom UIButton
My app creates dynamic copies of UI controls that are based on a custom UIButton subclass using this legacy approach: let archivedButton = try NSKeyedArchiver.archivedData(withRootObject: self, requiringSecureCoding: false) guard let buttonDuplicate = try NSKeyedUnarchiver.unarchiveTopLevelObjectWithData(archivedButton) as? UIWagerButton else {return nil } I am currently trying to work passed the deprecation of NSKeyedUnarchiver.unarchiveTopLevelObjectWithData(data: Data) Per the guidance, I should be replacing that line with the following and ensuring that the custom class implements NSSecureCoding guard let buttonDuplicate = try NSKeyedUnarchiver.unarchivedObject(ofClass: UIWagerButton.self, from: archivedButton) else {return nil} However, while the code does compile and run, decoding the data reference throws the following error: value for key 'UIButtonStatefulContent' was of unexpected class 'NSMutableDictionary' I can only assume that if I get passed this specific property, there will be other properties that are also problematic. Question: Is this a bug? Or, am I now responsible for navigating the underlying property matrix of this UIControl to specifically, manually, handle the encoding and decoding of each of it's properties?
0
0
403
Aug ’24
Can't find Python.h anywhere on Mac
I am trying to embed a python file that uses a python library in c, to do this I need to include python.h but I don't see it anywhere on my mac. Right now when I try to compile I just get a missing Python.h compile error. I tried using the search bar to find it in /usr and /library. Neither had the file. I tried doing #include <Python/python.h> and that doesn't change anything. Is trying to setup a virtual env the issue?
2
0
524
Aug ’24
Does objc_setAssociatedObject() work reliably when used with "bridgeable" Core Foundation types?
I'm investigating an odd problem that surfaced with macOS Sequoia related to CoreGraphics (CGColorSpaceCreateWithICCData()). I couldn't find a reliable way to track the lifetime (retain/releases) of a CGColorSpaceRef (any pointers appreciated) so I was hoping to use objc_setAssociatedObject() to attach an instance of my own class that would be deallocated when the "owning" CGColorSpaceRef is deallocated. In this way I could set a breakpoint on my own code, presumably invoked when the CGColorSpaceRef is itself going away. While objc_setAssociatedObject() does seem to work, the results don't seem deterministic. Is it because objc_setAssociatedObject() simply won't work reliably with CF types?
6
0
613
Aug ’24
TestIDs on iOS concatenated - React Native
Hey guys, so I have a problem regarding the testIDs on my react native that is reproducible only on iOS DOM meaning that I set the ids individually on the elements on a page but the problem is that somehow the ids are concatenated between them and inherits all the ids under the parent. As you can see and imagine in the accessibility inspector, this is what my DOM looks like. I want to point out that the problem does not reproduce on Android, only on iOS. Can somebody help me with this and tell me if there is a way to disable this concatenation? What's relevant to tell you it's the fact that I need each element to have an unique ID for browserstack automated tests. But as you can see in the image an element contains all IDs concatenated for some reason. And here is the code for the page with this issue
0
0
456
Jul ’24
OTA-updates for objective-c application
Hello! I have an application written in Objective-c/C++ and I would like it to have support for OTA updates. I implemented the logic through two executable files, one of which was responsible for launching and updating the first, but this option did not pass Apple's review. Could you tell me how this functionality can be implemented and so that it meets the requirements of the App Store.
1
0
358
Jul ’24
Objective-C++ confuses two private classes with the same name
I think I found a bug in the Objective-C++ compiler, linker, or runtime. Here’s the scenario: We have a macOS app written in Swift. To control hardware from a 3rd party manufacturer, we use a couple SDKs provided by the manufacturer. The SDKs use dynamically loaded libraries and the interface is defined in C++ headers. To bridge between our Swift code and the C++ APIs we have a private Cocoapod that wraps the 3rd party interface with Objective-C++ classes. The two SDKs each provide an interface for discovering attached devices using a callback class that the programmer provides. By accident we named both callback implementations DiscoveryCallback, but this was not a compiler error because neither class was publicly declared, and each was defined in the .mm file where it was used. However, the problem we’re seeing is this: We want to discover Videohub devices, so we register a new instance of DiscoveryCallback (defined in the same .mm file as this code) with the Videohub SDK. A Videohub device is connected and the SDK calls a method on our callback. Surprise! The callback we registered in step 1 was actually the one intended for Decklink devices, defined in a completely different .mm file. This violates all sorts of assumptions and our app quickly crashes. The funny thing is, the two implementations of DiscoveryCallback have completely different method names. The Videohub SDK is supposed to be calling NewVideohubDevice, yet somehow it successfully calls DeckLinkDeviceArrived on an instance of a class it shouldn’t even know about. So the compiler has checked that our intended DiscoveryCallback matches the protocol that the SDK expects, but at runtime the compiled code instantiates a completely different implementation of DiscoveryCallback and somehow doesn’t immediately fail; we still call a method on it that doesn’t even share a name with the intended target. I imagine at this point the method names are long forgotten and are just pointers in a table. I don’t know if this is a bug in the compiler, the Objective-C++ runtime, or if this is just “working as designed” undefined behavior that I should have avoided by not giving two private classes the same name. I know it’s possible to use a private API simply by redeclaring it in my own code, and this seems related to that, but I feel like the compiler or linker should have warned me that I had two implementations of the same class, or if that is not an error, then the runtime should have instantiated the class that was privately defined in the same source file where it was used. Obviously I can’t share our entire project; I’d like to provide some sample code that replicates the issue, but I don’t have time to do that right now. I’m posting this to see if other developers have had a similar experience.
2
1
556
Jul ’24
gfortran error
I am getting an following error while compiling the Fortran file with "gfortran TEST_1_fortran_only_fixed.f" ld: unsupported tapi file type '!tapi-tbd' in YAML file '/Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk/usr/lib/libSystem.tbd' for architecture x86_64 collect2: error: ld returned 1 exit status Please help me to solve this issue
1
0
362
Jul ’24
Create code at runtime on iOS: possible any more?
I'm the developer of 8th (https://8th-dev.com), which compiles the program at run-time, on the device. There used to be an iOS version which worked, but it seems things have changed since then. I'm trying to distribute an iOS version of an app written in 8th, and am encountering "SIGKILL - CODESIGNING" when trying to execute freshly compiled code. I am doing the 'sys_icache_invalidate' thing after writing into a mmap'ed bit of memory (rwx). I'm not writing into memory that was codesigned, so I don't know why the error is that. Anyway, the question is: is it possible any more to do what I used to be able to do?
5
1
729
Jul ’24
Exclude C runtime library from linking?
Hi, I am writing my own little toy programming language and when I try to link the binary object file (.o file) it requires a _main symbol. I wonder if there is a way to exclude this, presumably, a C runtime requirement? Is it safe to provide a stub _main symbol, or provide a the _main as the entry point to my own little runtime? What is the correct way to invoke the linker with the appropriate flags?
2
0
462
Jul ’24
dateFromString results in nil
In a completely new project using Objective-C, when using "NSDateFormatter" under the conditions mentioned, setting initWithLocaleIdentifier to "NSCalendarIdentifierGregorian" results in "dateFromString" returning nil. This issue is occurring specifically in iOS 18 beta 1 and 2, and it's causing me significant trouble. This process works correctly on iOS 17 and earlier versions. NSDateFormatter *formatter = [[NSDateFormatter alloc] init]; [formatter setTimeStyle:NSDateFormatterFullStyle]; [formatter setLocale:[[NSLocale alloc] initWithLocaleIdentifier:NSCalendarIdentifierGregorian]]; [formatter setDateFormat:formatStr]; NSDate *date = [formatter dateFromString:formatStr]; "date" is nil.
4
2
672
Jun ’24
dyld[11387]: Library not loaded: @loader_path/../../../../opt/icu4c/lib/libicuio.73.dylib
When I Run Php Artisan Command in PhpStorm Laravel Project The below results show in the terminal. dyld[11387]: Library not loaded: @loader_path/../../../../opt/icu4c/lib/libicuio.73.dylib Referenced from: &lt;27B43AEF-470B-32CD-9521-AA834300394F&gt; /usr/local/Cellar/php/8.2.10/bin/php Reason: tried: '/usr/local/Cellar/php/8.2.10/bin/../../../../opt/icu4c/lib/libicuio.73.dylib' (no such file), '/usr/local/lib/libicuio.73.dylib' (no such file), '/usr/lib/libicuio.73.dylib' (no such file, not in dyld cache) zsh: abort php artisan
1
0
568
Jun ’24