Apple Silicon

RSS for tag

Build apps, libraries, frameworks, plug-ins, and other executable code that run natively on Apple silicon.

Apple Silicon Documentation

Posts under Apple Silicon tag

69 Posts
Sort by:
Post not yet marked as solved
2 Replies
773 Views
While working through a SwiftUI Tutorial, I found that using: FileManager.default.url(for:, in:, appropriateFor:, create:) to locate a directory for persisting some data, does not work on Apple Silicon Macs when building an app for the "My Mac (Designed for iPad)". Quitting the app loses all state saved. Both the iPhone and iPad test devices are able to save and restore state using this method as usual. Is this the expected behavior? I expected that the M1 platform would be capable of simulating a similar file system for the application. Targeting macOS, iOS, and iPadOS, what's the simplest method to acquire a valid "Documents" or "Data" directory to persist information across launches and after app updates? (Before going nuclear with CoreData, just hasn't been the most friendly API to work with in my experience so far)
Posted
by
Post not yet marked as solved
124 Replies
83k Views
Can apple pls, pls, pls, tell me when can you fix the problem of m1 chip not support hidpi on external monitors? Or do you even aware of this problem? I've been using mac for a long time, and i was able to connect to a external monitor with high resolution and good size fonts using 3rd party softwares, like one-key-hidpi or rdm. However, now with your latest m1 chip, none of them work anymore. Now i can either use a high resolution with ant size fonts, or i can choose big font size with blurry displays resolution, which is very annoying. so, are we going to fix this issue? or is there any workaround for this?
Posted
by
Post not yet marked as solved
7 Replies
4.4k Views
For some simulation work-loads I have, I would like to use the system to its full potential and therefore use both P and E cores. Splitting the work-load into individual tasks is not easily possible (the threads communicate with each other and run in semi-lockstep). I can allocate smaller portions of the domain to the E cores (and iteratively adjust this so they take the same amount of time as the P cores). But in order for this to work well, I need to ensure that a given thread (with its associated workload) is bound to the right type of core: *either* the performance (doing larger chunks of the domain) or the efficiency (doing smaller chunks of the domain) cores. What's the best way to do this? So far, I don't think thread-to-core affinity has been something that was choosable in macOS. The documentation mentioned the QoS classes, but which class(es) (or relative priorities) would I pick? c pthread_set_qos_class_self_np(QOS_CLASS_UTILITY, 0); The existing classifications don't really map well, the work is user-initiated (i.e. they launched a console application), but not a GUI program. Would I use 4 threads with QOS_CLASS_UTILITY and 4 with QOS_CLASS_BACKGROUND? Would I just use UTILITY with relative priority for performance vs. efficiency cores?
Posted
by
Post not yet marked as solved
5 Replies
5.8k Views
I'm now running Tensorflow models on my Macbook Air 2020 M1, but I can't find a way to monitor the Neural Engine 16 cores usage to fine tune my ML tasks. The Activity Monitor only reports CPU% and GPU% and I can't find any APIs available on Mach include files in the MacOSX 11.1 sdk or documentation available so I can slap something together from scratch in C. Could anyone point me in some direction as to get a hold of the API for Neural Engine usage. Any indicator I could grab would be a start. It looks like this has been omitted from all sdk documentation and general userland, I've only found a ledger_tag_neural_footprint attribute, which looks memory related, and that's it.
Posted
by
Post not yet marked as solved
15 Replies
5.4k Views
I have code that has worked for many years for writing ProRes files, and it is now failing on the new M1 Max MacBook. Specifically, if I construct buffers with the pixel type "kCVPixelFormatType_64ARGB", after a few frames of writing, the pixel buffer pool becomes nil. This code works just fine on non Max processors (Intel and base M1 natively). Here's a sample main that demonstrates the problem. Am I doing something wrong here? //  main.m //  TestProresWriting // #import <Foundation/Foundation.h> #import <AVFoundation/AVFoundation.h> int main(int argc, const char * argv[]) {     @autoreleasepool {         int timescale = 24;         int width = 1920;         int height = 1080;         NSURL *url = [NSURL URLWithString:@"file:///Users/diftil/TempData/testfile.mov"];         NSLog(@"Output file = %@", [url absoluteURL]);         NSFileManager *fileManager = [NSFileManager defaultManager];         NSError *error = nil;         [fileManager removeItemAtURL:url error:&error];         // Set up the writer         AVAssetWriter *trackWriter = [[AVAssetWriter alloc] initWithURL:url                                                    fileType:AVFileTypeQuickTimeMovie                                                         error:&error];         // Set up the track         NSDictionary *videoSettings = [NSDictionary dictionaryWithObjectsAndKeys:                                        AVVideoCodecTypeAppleProRes4444, AVVideoCodecKey,                                        [NSNumber numberWithInt:width], AVVideoWidthKey,                                        [NSNumber numberWithInt:height], AVVideoHeightKey,                                        nil];                  AVAssetWriterInput *track = [AVAssetWriterInput assetWriterInputWithMediaType:AVMediaTypeVideo                                                         outputSettings:videoSettings];         // Set up the adapter         NSDictionary *attributes = [NSDictionary                                     dictionaryWithObjects:                                     [NSArray arrayWithObjects:[NSNumber numberWithUnsignedInt:kCVPixelFormatType_64ARGB], // This pixel type causes problems on M1 Max, but works on everything else                                      [NSNumber numberWithUnsignedInt:width],[NSNumber numberWithUnsignedInt:height],                                      nil]                                     forKeys:                                     [NSArray arrayWithObjects:(NSString *)kCVPixelBufferPixelFormatTypeKey,                                      (NSString*)kCVPixelBufferWidthKey, (NSString*)kCVPixelBufferHeightKey,                                      nil]];         /*         NSDictionary *attributes = [NSDictionary                                     dictionaryWithObjects:                                     [NSArray arrayWithObjects:[NSNumber numberWithUnsignedInt:kCVPixelFormatType_32ARGB], // This pixel type works on M1 Max                                      [NSNumber numberWithUnsignedInt:width],[NSNumber numberWithUnsignedInt:height],                                      nil]                                     forKeys:                                     [NSArray arrayWithObjects:(NSString *)kCVPixelBufferPixelFormatTypeKey,                                      (NSString*)kCVPixelBufferWidthKey, (NSString*)kCVPixelBufferHeightKey,                                      nil]];         */         AVAssetWriterInputPixelBufferAdaptor *pixelBufferAdaptor = [AVAssetWriterInputPixelBufferAdaptor                             assetWriterInputPixelBufferAdaptorWithAssetWriterInput:track                             sourcePixelBufferAttributes:attributes];         // Add the track and start writing         [trackWriter addInput:track];         [trackWriter startWriting];         CMTime startTime = CMTimeMake(0, timescale);         [trackWriter startSessionAtSourceTime:startTime];         while(!track.readyForMoreMediaData);         int frameTime = 0;         CVPixelBufferRef frameBuffer = NULL;         for (int i = 0; i < 100; i++)         {             NSLog(@"Frame %@", [NSString stringWithFormat:@"%d", i]);             CVPixelBufferPoolRef PixelBufferPool = pixelBufferAdaptor.pixelBufferPool;             if (PixelBufferPool == nil)             {                 NSLog(@"PixelBufferPool is invalid.");                 exit(1);             }             CVReturn ret = CVPixelBufferPoolCreatePixelBuffer(nil, PixelBufferPool, &frameBuffer);             if (ret != kCVReturnSuccess)             {                 NSLog(@"Error creating framebuffer from pool");                 exit(1);             }             CVPixelBufferLockBaseAddress(frameBuffer, 0);             // This is where we would put image data into the buffer.  Nothing right now.             CVPixelBufferUnlockBaseAddress(frameBuffer, 0);             while(!track.readyForMoreMediaData);             CMTime presentationTime = CMTimeMake(frameTime+(i*timescale), timescale);             BOOL result = [pixelBufferAdaptor appendPixelBuffer:frameBuffer                                            withPresentationTime:presentationTime];             if (result == NO)             {                 NSLog(@"Error appending to track.");                 exit(1);             }             CVPixelBufferRelease(frameBuffer);         }         // Close everything         if ( trackWriter.status == AVAssetWriterStatusWriting)             [track markAsFinished];         NSLog(@"Completed.");     }     return 0; }
Posted
by
Post not yet marked as solved
5 Replies
2.9k Views
On xcode 13, I have macos project that runs fine on intel machine. On apple silicon (M1 Plus) I get the error "A build only device cannot be used to run this target.", when I try to run from Xcode. This seems to be an ios error. All Google suggested fixes involve picking a new device which is an ios fix. Right? Bulids fine and Archive app runs fine. I get the error for both intel and Arm64 architectures. I tried building for Target deployment target device families and Deployment as: macos 12.0 sdk any suggestions?
Posted
by
Post not yet marked as solved
4 Replies
1.8k Views
I'm trying to get my iOS app to work on Apple silicon Macs, but ODR (On-Demand Resources) don't seem to work. It seems like the Xcode doesn't even acknowledge existence of ODR in the project when run as an iOS app for Mac on my M1 MacBook Air. I've created a very simple Xcode project to verify the issue, which only has a single image tagged as ODR. Checking the Disk tab in the Debug navigator, the ODR is shown correctly when running on a simulator: ...Yet when run as an iOS app for Mac it simply shows No Resources: The beginAccessingResources(...) call predictably fails, too, with the following error: Error: Error Domain=AssetErrorDomain Code=7 "Invalid status code `404`" UserInfo={NSDebugDescription=Invalid status code `404`, NSUnderlyingError=0x600003fd5fb0 {Error Domain=AssetErrorDomain Code=1404 "(null)"}} There are other messages in the console that could be related to the issue. The first thing the app logs when run as an iOS app for Mac, is this message repeated several times: 2022-01-20 12:14:41.566305+0000 ODRTest[29926:333135] [default] could not create original path for node <FSNode 0x600003191ca0> { isDir = ?, path = '/private/var/folders/kw/g_lttmtn0yx747mvzjmbksbc0000gn/X/FE0DB2BA-8F2D-5783-9BE1-891F8E117EC9/d/Wrapper/ODRTest.app' }, proceeding: Error Domain=NSPOSIXErrorDomain Code=1 "Operation not permitted" ODRTest is the name of the Xcode project I use to reproduce the issue. Nothing else is logged apart from these repeated messages and the ODR request error. The documentation here seems to explicitly suggest that ODR should work fine, so I'm guessing this is some odd configuration error on my machine — perhaps related to file system access? I've tried updating macOS and re-installing Xcode to latest from scratch to no avail. Anything else I'm missing here?
Posted
by
Post marked as solved
3 Replies
5.4k Views
MacOS M1 machines can run iOS applications. We have an iOS application that runs a fullscreen metal game. The game can also run across all desktop platforms via Steam. In additional to Steam, we would like to make it available through the AppStore on MacOS. We'd like to utilise our iOS builds for this so that the Apple payment (micro-transactions) and sign-in processes can be reused. While the app runs on MacOS, it runs in a small iPad shaped window that cannot be resized. We do not want to add iPad multitasking support (portrait orientation is not viable), but would like the window on MacOS to be expandable to full screen. Currently there is an option to make it full screen, but the metal view (MTKView) delegate does not receive a drawableSizeWillChange event for this, meaning the new resolution of the window cannot be received. Is there another method of retrieving a window size change event in this context? What is the recommended way of enabling window resizing on MacOS but not iPad for a single iOS app?
Posted
by
Post not yet marked as solved
7 Replies
4.0k Views
My device is MacBook Pro 13-inch, M1, 2020 Use source code provided by article https://developer.apple.com/documentation/virtualization/running_gui_linux_in_a_virtual_machine_on_a_mac When installing Debian, Fedora or Ubuntu, installation process can stuck at any point and cause the installation failed. Even if it is lucky enough to pass the installation phase, stuck could still happen at any time when the virtual machine is started. It seems that there is some low level error that cause the Linux kernel panic, while during this process error seems to be accumulated--it starts with some user level application in Linux starts to behave weirdly, such as sudo does not authenticate a valid user, apt can not run properly, then Linux kernel panic. Sometimes it behaves like the VM get stuck where it is not sure what happened inside it. I can't provide more detail as it happens randomly and the phenomenon differs each time. While generally it appears to be an accumulated error and eventually the VM get stuck.
Posted
by
Post not yet marked as solved
2 Replies
1.7k Views
Hi, I'm facing the issue for building the project for Simulator on M1 Mac. One of the suggested solutions was to enable Validate Workspace in project's Build Settings, but it seems it's not available in Xcode 14 anymore. Any suggestions?
Posted
by
Post not yet marked as solved
10 Replies
1.4k Views
I maintain a cross-platform client side network library for persistent TCP connections targeting Win32, Darwin and FreeBSD platforms. I recently upgraded to a Mac Studio w/ M1 Max (Ventura 13.1) from a late 2015 Intel Macbook Pro (Monterey 12.6.2) and I've encountered a discrepancy between the two. For secure TCP connections my lib uses WolfSSL across all platforms but also supports use of system provided Security libraries. On Darwin platforms this is SecureTransport. Yes I am aware SecureTransport is deprecated in favor of Network. I intend to attempt to integrate with Network later but for now my architecture dictates that I use similar C-style callbacks akin to WolfSSL, OpenSSL, MBedTLS etc. On the first call to SSLHandshake the SecureTransport write callback generates 151 bytes for my TLS 1.2 connection to example.com:443 on both platforms. However, while on Intel MBP I am able to continue with the full handshake I immediately receive 0 bytes with EOF. In Wireshark on the Intel MBP the 151 bytes are observed as a TLS 1.2 client hello while on M1 it is observed as an SSL continuation message and that is the last message observed.
Posted
by
Post not yet marked as solved
1 Replies
1.7k Views
Hi All, I would like to know if there are any C APIs to control the Floating-Point Control Register (FPCR) on Apple Silicon? The ARM documentation does not show any C APIs for doing this. The only example code looks like VHDL, so I was wondering if any developers here knew of any. Thanks
Posted
by
Post not yet marked as solved
4 Replies
1.2k Views
Hi, I have an iPad app that has menus, like:  CommandGroup(replacing: .help) {                 Button("Help") { showHelp = true }                     .keyboardShortcut("/")  } They works fine in iPad and also if compiled to Mac Catalyst, but will crash on Apple Silicon Mac when selected the menu items with errors like: [General] -[_UIEditMenuInteractionMenuController propertyList]: unrecognized selector sent to instance 0x600000190540 I did not use storyboard and only use SwiftUI. Any suggestions? Note: of course the best solution is to compile to Mac Catalyst, but the app has some other issues when run in Mac Catalyst. So I can only release it as iPad app.
Posted
by
Post marked as solved
3 Replies
1.2k Views
Hi. Sorry if this question has been answered in another post, if it has I can't find it. My device is MacBook Pro 16-inch, M1, 2021. So I tried to create a VM using this guide from Apple I followed the guide and used an image of debian. Everything worked fine until the machine appeared stuck at some point of the installation. I chose my languages then I had some other prompt asking me to install something but I can't remember precisely the step at which I thought it was freezed (I think it was the GNOME install) So because the machine was not responding for several minutes (I might have been too hurried) I quitted the process by simply clicking on the Quit button in the VM window. The problem is that from that point onward, I can't load any VM anymore. The build is successful in Xcode, the machine starts but immediately quits with this response from Xcode logs : Virtual machine successfully started. Guest did stop virtual machine. 2023-02-02 22:22:45.413600+0100 GUILinux[22984:380971] [client] No error handler for XPC error: Connection invalid I just can't understand why, I tried to delete and download the guide again but it doesn't work. I will add that it's my first time using Xcode and I might have missed something obivous.
Posted
by
Post not yet marked as solved
1 Replies
1.3k Views
Many useful ARM intrinsics (such as fma, rng, ld64b, etc.) are described in Arm C Language Extensions. But the arm_acle.h header file shipped with Xcode not include them. Are these intrinsics supported by Apple Silicon chip?
Posted
by
Post not yet marked as solved
2 Replies
1k Views
Users can run our apps on Macs with Apple Silicon via the "iPad Apps on Mac" feature. The apps use PHPhotoLibrary.requestAuthorization(for: .addOnly, handler: callback) to request write-only access to the user's Photo Library during image export. This works as intended on macOS, but a huge problem arises when the user denies access (by accident or intentionally) and later decides that they want us to add their image to Photos: There is no way to grant this permission again. In System Preferences → Privacy &amp;amp; Security → Photos, the app is just not listed – in fact, none of the "iPad Apps on Mac" apps appear here. Not even tccutil reset all my.bundle.id works. It just reports tccutil: Failed to reset all approval status for my.bundle.id. Uninstalling, restarting the Mac, and reinstalling the app also doesn't work. The system seems to remember the initial decision. Is this an oversight in the integration of those apps with macOS, or are we missing something fundamental here? Is there maybe a way to prompt the user again?
Posted
by
Post not yet marked as solved
0 Replies
633 Views
I'd like to build an XCFramework and the consuming app in a single workspace to make sure the latest version of the framework is bundled with the app. So both projects - framework and app - are bundled in a common workspace in Xcode; just as we are used to with regular frameworks. In the framework's project I'm creating the XCFramework as per Apple's instruction as a script-only target using xcodebuild -create-xcframework to bundle the individual framework binaries. Now I'd like to include the generated .xcframework in the app project. However, Xcode doesn’t seem to understand that the framework project target creating the XCFramework is actually creating output: I’ve added the XCFramework target as a dependency in the consuming project, it builds when the main project is built, but there’s no output to be selected in the Link with Libraries or Copy Frameworks steps of the app project Directly adding the framework via Finder as a folder from either Debug/Release folder doesn't make sense, which one would you pick? This is a trivial step for regular frameworks but apparently I'm overlooking something when dealing with the .xcframework. How to proceed? Thanks, Jay
Posted
by
Post not yet marked as solved
0 Replies
716 Views
Hi, I'm trying to build my project for a simulator using Xcode. Since my Mac has an M1 chip, when I choose a simulator as the destination, the application is only built for the arm64 architecture. How can I build for the generic/platform='iOS Simulator' as I do with the command "xcodebuild ... -destination generic/platform='iOS Simulator'"?
Posted
by