Explore the power of machine learning within apps. Discuss integrating machine learning features, share best practices, and explore the possibilities for your app.

Posts under General subtopic

Post

Replies

Boosts

Views

Activity

tensorflow-metal fails with tensorflow > 2.18.1
Also submitted as feedback (ID: FB20612561). Tensorflow-metal fails on tensorflow versions above 2.18.1, but works fine on tensorflow 2.18.1 In a new python 3.12 virtual environment: pip install tensorflow pip install tensor flow-metal python -c "import tensorflow as tf" Prints error: Traceback (most recent call last): File "", line 1, in File "/Users//pt/venv/lib/python3.12/site-packages/tensorflow/init.py", line 438, in _ll.load_library(_plugin_dir) File "/Users//pt/venv/lib/python3.12/site-packages/tensorflow/python/framework/load_library.py", line 151, in load_library py_tf.TF_LoadLibrary(lib) tensorflow.python.framework.errors_impl.NotFoundError: dlopen(/Users//pt/venv/lib/python3.12/site-packages/tensorflow-plugins/libmetal_plugin.dylib, 0x0006): Library not loaded: @rpath/_pywrap_tensorflow_internal.so Referenced from: <8B62586B-B082-3113-93AB-FD766A9960AE> /Users//pt/venv/lib/python3.12/site-packages/tensorflow-plugins/libmetal_plugin.dylib Reason: tried: '/Users//pt/venv/lib/python3.12/site-packages/tensorflow-plugins/../_solib_darwin_arm64/_U@local_Uconfig_Utf_S_S_C_Upywrap_Utensorflow_Uinternal___Uexternal_Slocal_Uconfig_Utf/_pywrap_tensorflow_internal.so' (no such file), '/Users//pt/venv/lib/python3.12/site-packages/tensorflow-plugins/../_solib_darwin_arm64/_U@local_Uconfig_Utf_S_S_C_Upywrap_Utensorflow_Uinternal___Uexternal_Slocal_Uconfig_Utf/_pywrap_tensorflow_internal.so' (no such file), '/opt/homebrew/lib/_pywrap_tensorflow_internal.so' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/opt/homebrew/lib/_pywrap_tensorflow_internal.so' (no such file)
6
4
2.6k
3w
tensorflow-metal error
I'm using python 3.9.6, tensorflow 2.20.0, tensorflow-metal 1.2.0, and when I try to run import tensorflow as tf It gives Traceback (most recent call last): File "/Users/haoduoyu/Code/demo.py", line 1, in <module> import tensorflow as tf File "/Users/haoduoyu/Code/test/lib/python3.9/site-packages/tensorflow/__init__.py", line 438, in <module> _ll.load_library(_plugin_dir) File "/Users/haoduoyu/Code/test/lib/python3.9/site-packages/tensorflow/python/framework/load_library.py", line 151, in load_library py_tf.TF_LoadLibrary(lib) tensorflow.python.framework.errors_impl.NotFoundError: dlopen(/Users/haoduoyu/Code/test/lib/python3.9/site-packages/tensorflow-plugins/libmetal_plugin.dylib, 0x0006): Library not loaded: @rpath/_pywrap_tensorflow_internal.so Referenced from: <8B62586B-B082-3113-93AB-FD766A9960AE> /Users/haoduoyu/Code/test/lib/python3.9/site-packages/tensorflow-plugins/libmetal_plugin.dylib Reason: tried: '/Users/haoduoyu/Code/test/lib/python3.9/site-packages/tensorflow-plugins/../_solib_darwin_arm64/_U@local_Uconfig_Utf_S_S_C_Upywrap_Utensorflow_Uinternal___Uexternal_Slocal_Uconfig_Utf/_pywrap_tensorflow_internal.so' (no such file), '/Users/haoduoyu/Code/test/lib/python3.9/site-packages/tensorflow-plugins/../_solib_darwin_arm64/_U@local_Uconfig_Utf_S_S_C_Upywrap_Utensorflow_Uinternal___Uexternal_Slocal_Uconfig_Utf/_pywrap_tensorflow_internal.so' (no such file) As long as I uninstall tensorflow-metal, nothing goes wrong. How can I fix this problem?
3
3
1.4k
Jan ’26
AXSpeech Crash
I have a very terrible crash problem in my App when I use AVSpeechSynthesizer and I can't repetition it.Here is my code, It's a singleton- (void)stopSpeech { if ([self.synthesizer isPaused]) { return; } if ([self.synthesizer isSpeaking]) { BOOL isSpeech = [self.synthesizer stopSpeakingAtBoundary:AVSpeechBoundaryImmediate]; if (!isSpeech) { [self.synthesizer stopSpeakingAtBoundary:AVSpeechBoundaryWord]; } } self.stopBlock ? self.stopBlock() : nil; } -(AVSpeechSynthesizer *)synthesizer { if (!_synthesizer) { _synthesizer = [[AVSpeechSynthesizer alloc] init]; _synthesizer.delegate = self; } return _synthesizer; }When the user leaves the page, I call the stopSpeech method。Then I got a lot of crash messagesHere is a crash log:# Crashlytics - plaintext stacktrace downloaded by liweican at Mon, 13 May 2019 03:03:24 GMT # URL: https://fabric.io/youdao-dict/ios/apps/com.youdao.udictionary/issues/5a904ed88cb3c2fa63ad7ed3?time=last-thirty-days/sessions/b1747d91bafc4680ab0ca8e3a702c52c_DNE_0_v2 # Organization: zzz # Platform: ios # Application: U-Dictionary # Version: 3.0.5.4 # Bundle Identifier: com.youdao.UDictionary # Issue ID: 5a904ed88cb3c2fa63ad7ed3 # Session ID: b1747d91bafc4680ab0ca8e3a702c52c_DNE_0_v2 # Date: 2019-05-13T02:27:00Z # OS Version: 12.2.0 (16E227) # Device: iPhone 8 Plus # RAM Free: 17% # Disk Free: 64.6% #19. Crashed: AXSpeech 0 libsystem_pthread.dylib 0x19c15e5b8 pthread_mutex_lock$VARIANT$armv81 + 102 1 CoreFoundation 0x19c4cf84c CFRunLoopSourceSignal + 68 2 Foundation 0x19cfc7280 performQueueDequeue + 464 3 Foundation 0x19cfc680c __NSThreadPerformPerform + 136 4 CoreFoundation 0x19c4d22bc __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 24 5 CoreFoundation 0x19c4d223c __CFRunLoopDoSource0 + 88 6 CoreFoundation 0x19c4d1b74 __CFRunLoopDoSources0 + 256 7 CoreFoundation 0x19c4cca60 __CFRunLoopRun + 1004 8 CoreFoundation 0x19c4cc354 CFRunLoopRunSpecific + 436 9 Foundation 0x19ce99fcc -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 300 10 libAXSpeechManager.dylib 0x1ac16c94c -[AXSpeechThread main] + 264 11 Foundation 0x19cfc66e4 __NSThread__start__ + 984 12 libsystem_pthread.dylib 0x19c1602c0 _pthread_body + 128 13 libsystem_pthread.dylib 0x19c160220 _pthread_start + 44 14 libsystem_pthread.dylib 0x19c163cdc thread_start + 4 -- #0. com.apple.main-thread 0 libsystem_malloc.dylib 0x19c11ce24 small_free_list_remove_ptr_no_clear + 768 1 libsystem_malloc.dylib 0x19c11f094 small_malloc_from_free_list + 296 2 libsystem_malloc.dylib 0x19c11f094 small_malloc_from_free_list + 296 3 libsystem_malloc.dylib 0x19c11d63c small_malloc_should_clear + 224 4 libsystem_malloc.dylib 0x19c11adcc szone_malloc_should_clear + 132 5 libsystem_malloc.dylib 0x19c123c18 malloc_zone_malloc + 156 6 CoreFoundation 0x19c569ab4 __CFBasicHashRehash + 300 7 CoreFoundation 0x19c56b430 __CFBasicHashAddValue + 96 8 CoreFoundation 0x19c56ab9c CFBasicHashAddValue + 2160 9 CoreFoundation 0x19c49f3bc CFDictionaryAddValue + 260 10 CoreFoundation 0x19c572ee8 __54-[CFPrefsSource mergeIntoDictionary:sourceDictionary:]_block_invoke + 28 11 CoreFoundation 0x19c49f0b4 __CFDictionaryApplyFunction_block_invoke + 24 12 CoreFoundation 0x19c568b7c CFBasicHashApply + 116 13 CoreFoundation 0x19c49f090 CFDictionaryApplyFunction + 168 14 CoreFoundation 0x19c42f504 -[CFPrefsSource mergeIntoDictionary:sourceDictionary:] + 136 15 CoreFoundation 0x19c4bcd38 -[CFPrefsSearchListSource alreadylocked_getDictionary:] + 644 16 CoreFoundation 0x19c42e71c -[CFPrefsSearchListSource alreadylocked_copyValueForKey:] + 152 17 CoreFoundation 0x19c42e660 -[CFPrefsSource copyValueForKey:] + 60 18 CoreFoundation 0x19c579e88 __76-[_CFXPreferences copyAppValueForKey:identifier:container:configurationURL:]_block_invoke + 40 19 CoreFoundation 0x19c4bdff4 __108-[_CFXPreferences(SearchListAdditions) withSearchListForIdentifier:container:cloudConfigurationURL:perform:]_block_invoke + 272 20 CoreFoundation 0x19c4bda38 normalizeQuintuplet + 340 21 CoreFoundation 0x19c42c634 -[_CFXPreferences(SearchListAdditions) withSearchListForIdentifier:container:cloudConfigurationURL:perform:] + 108 22 CoreFoundation 0x19c42cec0 -[_CFXPreferences copyAppValueForKey:identifier:container:configurationURL:] + 148 23 CoreFoundation 0x19c57c2d0 _CFPreferencesCopyAppValueWithContainerAndConfiguration + 124 24 TextInput 0x1a450e550 -[TIPreferencesController valueForPreferenceKey:] + 460 25 UIKitCore 0x1c87c71f8 -[UIKeyboardPreferencesController handBias] + 36 26 UIKitCore 0x1c887275c -[UIKeyboardLayoutStar showKeyboardWithInputTraits:screenTraits:splitTraits:] + 320 27 UIKitCore 0x1c88f4240 -[UIKeyboardImpl finishLayoutChangeWithArguments:] + 492 28 UIKitCore 0x1c88f47c8 -[UIKeyboardImpl updateLayout] + 1208 29 UIKitCore 0x1c88eaad0 -[UIKeyboardImpl updateLayoutIfNecessary] + 448 30 UIKitCore 0x1c88eab9c -[UIKeyboardImpl setFrame:] + 140 31 UIKitCore 0x1c88d5d60 -[UIKeyboard activate] + 652 32 UIKitCore 0x1c894c90c -[UIKeyboardAutomatic activate] + 128 33 UIKitCore 0x1c88d5158 -[UIKeyboard setFrame:] + 296 34 UIKitCore 0x1c88d81b0 -[UIKeyboard _didChangeKeyplaneWithContext:] + 228 35 UIKitCore 0x1c88f4aa0 -[UIKeyboardImpl didMoveToSuperview] + 136 36 UIKitCore 0x1c8f2ad84 __45-[UIView(Hierarchy) _postMovedFromSuperview:]_block_invoke + 888 37 UIKitCore 0x1c8f2a970 -[UIView(Hierarchy) _postMovedFromSuperview:] + 760 38 UIKitCore 0x1c8f39ddc -[UIView(Internal) _addSubview:positioned:relativeTo:] + 1740 39 UIKitCore 0x1c88d5d84 -[UIKeyboard activate] + 688 40 UIKitCore 0x1c894c90c -[UIKeyboardAutomatic activate] + 128 41 UIKitCore 0x1c893b3a4 -[UIPeripheralHost(UIKitInternal) _reloadInputViewsForResponder:] + 1332 42 UIKitCore 0x1c8ae66d8 -[UIResponder(UIResponderInputViewAdditions) reloadInputViews] + 80 43 UIKitCore 0x1c8ae23bc -[UIResponder becomeFirstResponder] + 804 44 UIKitCore 0x1c8f2a560 -[UIView(Hierarchy) becomeFirstResponder] + 156 45 UIKitCore 0x1c8d93e84 -[UITextField becomeFirstResponder] + 244 46 UIKitCore 0x1c8d578dc -[UITextInteractionAssistant(UITextInteractionAssistant_Internal) setFirstResponderIfNecessary] + 192 47 UIKitCore 0x1c8d45d8c -[UITextSelectionInteraction oneFingerTap:] + 3136 48 UIKitCore 0x1c86e0bcc -[UIGestureRecognizerTarget _sendActionWithGestureRecognizer:] + 64 49 UIKitCore 0x1c86e8dd4 _UIGestureRecognizerSendTargetActions + 124 50 UIKitCore 0x1c86e6778 _UIGestureRecognizerSendActions + 316 51 UIKitCore 0x1c86e5ca4 -[UIGestureRecognizer _updateGestureWithEvent:buttonEvent:] + 760 52 UIKitCore 0x1c86d9d80 _UIGestureEnvironmentUpdate + 2180 53 UIKitCore 0x1c86d94b0 -[UIGestureEnvironment _deliverEvent:toGestureRecognizers:usingBlock:] + 384 54 UIKitCore 0x1c86d9290 -[UIGestureEnvironment _updateForEvent:window:] + 204 55 UIKitCore 0x1c8af14a8 -[UIWindow sendEvent:] + 3112 56 UIKitCore 0x1c8ad1534 -[UIApplication sendEvent:] + 340 57 UIKitCore 0x1c8b977c0 __dispatchPreprocessedEventFromEventQueue + 1768 58 UIKitCore 0x1c8b99eec __handleEventQueueInternal + 4828 59 UIKitCore 0x1c8b9311c __handleHIDEventFetcherDrain + 152 60 CoreFoundation 0x19c4d22bc __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 24 61 CoreFoundation 0x19c4d223c __CFRunLoopDoSource0 + 88 62 CoreFoundation 0x19c4d1b24 __CFRunLoopDoSources0 + 176 63 CoreFoundation 0x19c4cca60 __CFRunLoopRun + 1004 64 CoreFoundation 0x19c4cc354 CFRunLoopRunSpecific + 436 65 GraphicsServices 0x19e6cc79c GSEventRunModal + 104 66 UIKitCore 0x1c8ab7b68 UIApplicationMain + 212 67 UDictionary 0x10517e138 main (main.m:17) 68 libdyld.dylib 0x19bf928e0 start + 4 #1. Thread 0 libsystem_kernel.dylib 0x19c0deb74 __workq_kernreturn + 8 1 libsystem_pthread.dylib 0x19c161138 _pthread_wqthread + 340 2 libsystem_pthread.dylib 0x19c163cd4 start_wqthread + 4 #2. com.apple.uikit.eventfetch-thread 0 libsystem_kernel.dylib 0x19c0d30f4 mach_msg_trap + 8 1 libsystem_kernel.dylib 0x19c0d25a0 mach_msg + 72 2 CoreFoundation 0x19c4d1cb4 __CFRunLoopServiceMachPort + 236 3 CoreFoundation 0x19c4ccbc4 __CFRunLoopRun + 1360 4 CoreFoundation 0x19c4cc354 CFRunLoopRunSpecific + 436 5 Foundation 0x19ce99fcc -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 300 6 Foundation 0x19ce99e5c -[NSRunLoop(NSRunLoop) runUntilDate:] + 96 7 UIKitCore 0x1c8b9d540 -[UIEventFetcher threadMain] + 136 8 Foundation 0x19cfc66e4 __NSThread__start__ + 984 9 libsystem_pthread.dylib 0x19c1602c0 _pthread_body + 128 10 libsystem_pthread.dylib 0x19c160220 _pthread_start + 44 11 libsystem_pthread.dylib 0x19c163cdc thread_start + 4 #3. JavaScriptCore bmalloc scavenger 0 libsystem_kernel.dylib 0x19c0ddee4 __psynch_cvwait + 8 1 libsystem_pthread.dylib 0x19c15d4a4 _pthread_cond_wait$VARIANT$armv81 + 628 2 libc++.1.dylib 0x19b6b5090 std::__1::condition_variable::wait(std::__1::unique_lock&lt;std::__1::mutex&gt;&amp;) + 24 3 JavaScriptCore 0x1a36a2238 void std::__1::condition_variable_any::wait&lt;std::__1::unique_lock&lt;bmalloc::Mutex&gt; &gt;(std::__1::unique_lock&lt;bmalloc::Mutex&gt;&amp;) + 108 4 JavaScriptCore 0x1a36a622c bmalloc::Scavenger::threadRunLoop() + 176 5 JavaScriptCore 0x1a36a59a4 bmalloc::Scavenger::Scavenger(std::__1::lock_guard&lt;bmalloc::Mutex&gt;&amp;) + 10 6 JavaScriptCore 0x1a36a73e4 std::__1::__thread_specific_ptr&lt;std::__1::__thread_struct&gt;::set_pointer(std::__1::__thread_struct*) + 38 7 libsystem_pthread.dylib 0x19c1602c0 _pthread_body + 128 8 libsystem_pthread.dylib 0x19c160220 _pthread_start + 44 9 libsystem_pthread.dylib 0x19c163cdc thread_start + 4 #4. WebThread 0 libsystem_kernel.dylib 0x19c0d30f4 mach_msg_trap + 8 1 libsystem_kernel.dylib 0x19c0d25a0 mach_msg + 72 2 CoreFoundation 0x19c4d1cb4 __CFRunLoopServiceMachPort + 236 3 CoreFoundation 0x19c4ccbc4 __CFRunLoopRun + 1360 4 CoreFoundation 0x19c4cc354 CFRunLoopRunSpecific + 436 5 WebCore 0x1a5126480 RunWebThread(void*) + 600 6 libsystem_pthread.dylib 0x19c1602c0 _pthread_body + 128 7 libsystem_pthread.dylib 0x19c160220 _pthread_start + 44 8 libsystem_pthread.dylib 0x19c163cdc thread_start + 4 #5. com.twitter.crashlytics.ios.MachExceptionServer 0 UDictionary 0x1058a5564 CLSProcessRecordAllThreads (CLSProcess.c:376) 1 UDictionary 0x1058a594c CLSProcessRecordAllThreads (CLSProcess.c:407) 2 UDictionary 0x1058952dc CLSHandler (CLSHandler.m:26) 3 UDictionary 0x1058906cc CLSMachExceptionServer (CLSMachException.c:446) 4 libsystem_pthread.dylib 0x19c1602c0 _pthread_body + 128 5 libsystem_pthread.dylib 0x19c160220 _pthread_start + 44 6 libsystem_pthread.dylib 0x19c163cdc thread_start + 4 #6. com.apple.NSURLConnectionLoader 0 libsystem_kernel.dylib 0x19c0d30f4 mach_msg_trap + 8 1 libsystem_kernel.dylib 0x19c0d25a0 mach_msg + 72 2 CoreFoundation 0x19c4d1cb4 __CFRunLoopServiceMachPort + 236 3 CoreFoundation 0x19c4ccbc4 __CFRunLoopRun + 1360 4 CoreFoundation 0x19c4cc354 CFRunLoopRunSpecific + 436 5 CFNetwork 0x19cae574c -[__CoreSchedulingSetRunnable runForever] + 216 6 Foundation 0x19cfc66e4 __NSThread__start__ + 984 7 libsystem_pthread.dylib 0x19c1602c0 _pthread_body + 128 8 libsystem_pthread.dylib 0x19c160220 _pthread_start + 44 9 libsystem_pthread.dylib 0x19c163cdc thread_start + 4 #7. AVAudioSession Notify Thread 0 libsystem_kernel.dylib 0x19c0d30f4 mach_msg_trap + 8 1 libsystem_kernel.dylib 0x19c0d25a0 mach_msg + 72 2 CoreFoundation 0x19c4d1cb4 __CFRunLoopServiceMachPort + 236 3 CoreFoundation 0x19c4ccbc4 __CFRunLoopRun + 1360 4 CoreFoundation 0x19c4cc354 CFRunLoopRunSpecific + 436 5 AVFAudio 0x1a238a378 GenericRunLoopThread::Entry(void*) + 156 6 AVFAudio 0x1a23b4c60 CAPThread::Entry(CAPThread*) + 88 7 libsystem_pthread.dylib 0x19c1602c0 _pthread_body + 128 8 libsystem_pthread.dylib 0x19c160220 _pthread_start + 44 9 libsystem_pthread.dylib 0x19c163cdc thread_start + 4 #8. WebCore: LocalStorage 0 libsystem_kernel.dylib 0x19c0ddee4 __psynch_cvwait + 8 1 libsystem_pthread.dylib 0x19c15d4a4 _pthread_cond_wait$VARIANT$armv81 + 628 2 JavaScriptCore 0x1a3668ce4 ***::ThreadCondition::timedWait(***::Mutex&amp;, ***::WallTime) + 80 3 JavaScriptCore 0x1a364f96c ***::ParkingLot::parkConditionallyImpl(void const*, ***::ScopedLambda&lt;bool ()&gt; const&amp;, ***::ScopedLambda&lt;void ()&gt; const&amp;, ***::TimeWithDynamicClockType const&amp;) + 2004 4 WebKitLegacy 0x1a67b6ea8 bool ***::Condition::waitUntil&lt;***::Lock&gt;(***::Lock&amp;, ***::TimeWithDynamicClockType const&amp;) + 184 5 WebKitLegacy 0x1a67b9ba4 std::__1::unique_ptr&lt;***::Function&lt;void ()&gt;, std::__1::default_delete&lt;***::Function&lt;void ()&gt; &gt; &gt; ***::MessageQueue&lt;***::Function&lt;void ()&gt; &gt;::waitForMessageFilteredWithTimeout&lt;***::MessageQueue&lt;***::Function&lt;void ()&gt; &gt;::waitForMessage()::'lambda'(***::Function&lt;void ()&gt; const&amp;)&gt;(***::MessageQueueWaitResult&amp;, ***::MessageQueue&lt;***::Function&lt;void ()&gt; &gt;::waitForMessage()::'lambda'(***::Function&lt;void ()&gt; const&amp;)&amp;&amp;, ***::WallTime) + 156 6 WebKitLegacy 0x1a67b91c0 WebCore::StorageThread::threadEntryPoint() + 68 7 JavaScriptCore 0x1a3666f88 ***::Thread::entryPoint(***::Thread::NewThreadContext*) + 260 8 JavaScriptCore 0x1a3668494 ***::wtfThreadEntryPoint(void*) + 12 9 libsystem_pthread.dylib 0x19c1602c0 _pthread_body + 128 10 libsystem_pthread.dylib 0x19c160220 _pthread_start + 44 11 libsystem_pthread.dylib 0x19c163cdc thread_start + 4 #9. com.apple.CoreMotion.MotionThread 0 libsystem_kernel.dylib 0x19c0d30f4 mach_msg_trap + 8 1 libsystem_kernel.dylib 0x19c0d25a0 mach_msg + 72 2 CoreFoundation 0x19c4d1cb4 __CFRunLoopServiceMachPort + 236 3 CoreFoundation 0x19c4ccbc4 __CFRunLoopRun + 1360 4 CoreFoundation 0x19c4cc354 CFRunLoopRunSpecific + 436 5 CoreFoundation 0x19c4cd0b0 CFRunLoopRun + 80 6 CoreMotion 0x1a1df0240 (Missing) 7 libsystem_pthread.dylib 0x19c1602c0 _pthread_body + 128 8 libsystem_pthread.dylib 0x19c160220 _pthread_start + 44 9 libsystem_pthread.dylib 0x19c163cdc thread_start + 4 #10. Thread 0 libsystem_kernel.dylib 0x19c0deb74 __workq_kernreturn + 8 1 libsystem_pthread.dylib 0x19c161138 _pthread_wqthread + 340 2 libsystem_pthread.dylib 0x19c163cd4 start_wqthread + 4 #11. Thread 0 libsystem_kernel.dylib 0x19c0deb74 __workq_kernreturn + 8 1 libsystem_pthread.dylib 0x19c1611f8 _pthread_wqthread + 532 2 libsystem_pthread.dylib 0x19c163cd4 start_wqthread + 4 #12. com.apple.CFStream.LegacyThread 0 libsystem_kernel.dylib 0x19c0d30f4 mach_msg_trap + 8 1 libsystem_kernel.dylib 0x19c0d25a0 mach_msg + 72 2 CoreFoundation 0x19c4d1cb4 __CFRunLoopServiceMachPort + 236 3 CoreFoundation 0x19c4ccbc4 __CFRunLoopRun + 1360 4 CoreFoundation 0x19c4cc354 CFRunLoopRunSpecific + 436 5 CoreFoundation 0x19c4e5094 _legacyStreamRunLoop_workThread + 260 6 libsystem_pthread.dylib 0x19c1602c0 _pthread_body + 128 7 libsystem_pthread.dylib 0x19c160220 _pthread_start + 44 8 libsystem_pthread.dylib 0x19c163cdc thread_start + 4 #13. Thread 0 libsystem_pthread.dylib 0x19c163cd0 start_wqthread + 190 #14. Thread 0 libsystem_kernel.dylib 0x19c0deb74 __workq_kernreturn + 8 1 libsystem_pthread.dylib 0x19c161138 _pthread_wqthread + 340 2 libsystem_pthread.dylib 0x19c163cd4 start_wqthread + 4 #15. Thread 0 libsystem_kernel.dylib 0x19c0deb74 __workq_kernreturn + 8 1 libsystem_pthread.dylib 0x19c161138 _pthread_wqthread + 340 2 libsystem_pthread.dylib 0x19c163cd4 start_wqthread + 4 #16. Thread 0 libsystem_kernel.dylib 0x19c0d3148 semaphore_timedwait_trap + 8 1 libdispatch.dylib 0x19bf50a4c _dispatch_sema4_timedwait$VARIANT$armv81 + 64 2 libdispatch.dylib 0x19bf513a8 _dispatch_semaphore_wait_slow + 72 3 libdispatch.dylib 0x19bf647c8 _dispatch_worker_thread + 344 4 libsystem_pthread.dylib 0x19c1602c0 _pthread_body + 128 5 libsystem_pthread.dylib 0x19c160220 _pthread_start + 44 6 libsystem_pthread.dylib 0x19c163cdc thread_start + 4 #17. Thread 0 libsystem_kernel.dylib 0x19c0d3148 semaphore_timedwait_trap + 8 1 libdispatch.dylib 0x19bf50a4c _dispatch_sema4_timedwait$VARIANT$armv81 + 64 2 libdispatch.dylib 0x19bf513a8 _dispatch_semaphore_wait_slow + 72 3 libdispatch.dylib 0x19bf647c8 _dispatch_worker_thread + 344 4 libsystem_pthread.dylib 0x19c1602c0 _pthread_body + 128 5 libsystem_pthread.dylib 0x19c160220 _pthread_start + 44 6 libsystem_pthread.dylib 0x19c163cdc thread_start + 4 #18. Thread 0 libsystem_kernel.dylib 0x19c0d3148 semaphore_timedwait_trap + 8 1 libdispatch.dylib 0x19bf50a4c _dispatch_sema4_timedwait$VARIANT$armv81 + 64 2 libdispatch.dylib 0x19bf513a8 _dispatch_semaphore_wait_slow + 72 3 libdispatch.dylib 0x19bf647c8 _dispatch_worker_thread + 344 4 libsystem_pthread.dylib 0x19c1602c0 _pthread_body + 128 5 libsystem_pthread.dylib 0x19c160220 _pthread_start + 44 6 libsystem_pthread.dylib 0x19c163cdc thread_start + 4 #19. Crashed: AXSpeech 0 libsystem_pthread.dylib 0x19c15e5b8 pthread_mutex_lock$VARIANT$armv81 + 102 1 CoreFoundation 0x19c4cf84c CFRunLoopSourceSignal + 68 2 Foundation 0x19cfc7280 performQueueDequeue + 464 3 Foundation 0x19cfc680c __NSThreadPerformPerform + 136 4 CoreFoundation 0x19c4d22bc __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 24 5 CoreFoundation 0x19c4d223c __CFRunLoopDoSource0 + 88 6 CoreFoundation 0x19c4d1b74 __CFRunLoopDoSources0 + 256 7 CoreFoundation 0x19c4cca60 __CFRunLoopRun + 1004 8 CoreFoundation 0x19c4cc354 CFRunLoopRunSpecific + 436 9 Foundation 0x19ce99fcc -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 300 10 libAXSpeechManager.dylib 0x1ac16c94c -[AXSpeechThread main] + 264 11 Foundation 0x19cfc66e4 __NSThread__start__ + 984 12 libsystem_pthread.dylib 0x19c1602c0 _pthread_body + 128 13 libsystem_pthread.dylib 0x19c160220 _pthread_start + 44 14 libsystem_pthread.dylib 0x19c163cdc thread_start + 4 #20. AXSpeech 0 (Missing) 0x1071ba524 (Missing) 1 (Missing) 0x1071b3e7c (Missing) 2 (Missing) 0x10718fba4 (Missing) 3 (Missing) 0x107184bc8 (Missing) 4 libdyld.dylib 0x19bf95908 dlopen + 176 5 CoreFoundation 0x19c5483e8 _CFBundleDlfcnLoadBundle + 140 6 CoreFoundation 0x19c486918 _CFBundleLoadExecutableAndReturnError + 352 7 Foundation 0x19ced5734 -[NSBundle loadAndReturnError:] + 428 8 TextToSpeech 0x1abfff800 TTSSpeechUnitTestingMode + 1020 9 libdispatch.dylib 0x19bf817d4 _dispatch_client_callout + 16 10 libdispatch.dylib 0x19bf52040 _dispatch_once_callout + 28 11 TextToSpeech 0x1abfff478 TTSSpeechUnitTestingMode + 116 12 libobjc.A.dylib 0x19b7173cc CALLING_SOME_+initialize_METHOD + 24 13 libobjc.A.dylib 0x19b71cee0 initializeNonMetaClass + 296 14 libobjc.A.dylib 0x19b71e640 initializeAndMaybeRelock(objc_class*, objc_object*, mutex_tt&lt;false&gt;&amp;, bool) + 260 15 libobjc.A.dylib 0x19b7265a4 lookUpImpOrForward + 244 16 libobjc.A.dylib 0x19b733858 _objc_msgSend_uncached + 56 17 libAXSpeechManager.dylib 0x1ac167324 -[AXSpeechManager _initialize] + 68 18 Foundation 0x19cfc68d4 __NSThreadPerformPerform + 336 19 CoreFoundation 0x19c4d22bc __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 24 20 CoreFoundation 0x19c4d223c __CFRunLoopDoSource0 + 88 21 CoreFoundation 0x19c4d1b74 __CFRunLoopDoSources0 + 256 22 CoreFoundation 0x19c4cca60 __CFRunLoopRun + 1004 23 CoreFoundation 0x19c4cc354 CFRunLoopRunSpecific + 436 24 Foundation 0x19ce99fcc -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 300 25 libAXSpeechManager.dylib 0x1ac16c94c -[AXSpeechThread main] + 264 26 Foundation 0x19cfc66e4 __NSThread__start__ + 984 27 libsystem_pthread.dylib 0x19c1602c0 _pthread_body + 128 28 libsystem_pthread.dylib 0x19c160220 _pthread_start + 44 29 libsystem_pthread.dylib 0x19c163cdc thread_start + 4I change my code like this, It still has the same problem- (void)stopSpeech { if (self.synthesizer != nil &amp;&amp; [self.synthesizer isPaused]) { return; } // if ([self.synthesizer isSpeaking]) { // BOOL isSpeech = [self.synthesizer stopSpeakingAtBoundary:AVSpeechBoundaryImmediate]; // if (!isSpeech) { // [self.synthesizer stopSpeakingAtBoundary:AVSpeechBoundaryWord]; // } // } if (self.synthesizer != nil) { [self.synthesizer stopSpeakingAtBoundary:AVSpeechBoundaryImmediate]; // if (!isSpeech) { // [self.synthesizer stopSpeakingAtBoundary:AVSpeechBoundaryWord]; // } self.stopBlock ? self.stopBlock() : nil; } }
1
1
2.4k
9h
Vision and iOS18 - Failed to create espresso context.
I'm playing with the new Vision API for iOS18, specifically with the new CalculateImageAestheticsScoresRequest API. When I try to perform the image observation request I get this error: internalError("Error Domain=NSOSStatusErrorDomain Code=-1 \"Failed to create espresso context.\" UserInfo={NSLocalizedDescription=Failed to create espresso context.}") The code is pretty straightforward: if let image = image { let request = CalculateImageAestheticsScoresRequest() Task { do { let cgImg = image.cgImage! let observations = try await request.perform(on: cgImg) let description = observations.description let score = observations.overallScore print(description) print(score) } catch { print(error) } } } I'm running it on a M2 using the simulator. Is it a bug? What's wrong?
3
1
1.7k
Sep ’25
Crash inside of Vision framework during VNImageRequestHandler use
Hello, I've been dealing with a puzzling issue for some time now, and I’m hoping someone here might have insights or suggestions. The Problem: We’re observing an occasional crash in our app that seems to originate from the Vision framework. Frequency: It happens randomly, after many successful executions of the same code, hard to tell how long the app was working, but in some cases app could run for like a month without any issues. Devices: The issue doesn't seem device-dependent (we’ve seen it on various iPad models). OS Versions: The crashes started occurring with iOS 18.0.1 and are still present in 18.1 and 18.1.1. What I suspected: The crash logs point to a potential data race within the Vision framework. The relevant section of the code where the crash happens: guard let cgImage = image.cgImage else { throw ... } let request = VNCoreMLRequest(model: visionModel) try VNImageRequestHandler(cgImage: cgImage).perform([request]) // <- the line causing the crash Since the code is rather simple, I'm not sure what else there could be missing here. The images sent here are uniform (fixed size). Model is loaded and working, the crash occurs random after a period of time and the call worked correctly many times. Also, the model variable is not an optional. Here is the crash log: libobjc.A objc_exception_throw CoreFoundation -[NSMutableArray removeObjectsAtIndexes:] Vision -[VNWeakTypeWrapperCollection _enumerateObjectsDroppingWeakZeroedObjects:usingBlock:] Vision -[VNWeakTypeWrapperCollection addObject:droppingWeakZeroedObjects:] Vision -[VNSession initWithCachingBehavior:] Vision -[VNCoreMLTransformer initWithOptions:model:error:] Vision -[VNCoreMLRequest internalPerformRevision:inContext:error:] Vision -[VNRequest performInContext:error:] Vision -[VNRequestPerformer _performOrderedRequests:inContext:error:] Vision -[VNRequestPerformer _performRequests:onBehalfOfRequest:inContext:error:] Vision -[VNImageRequestHandler performRequests:gatheredForensics:error:] OurApp ModelWrapper.perform And I'm a bit lost at this point, I've tried everything I could image so far. I've tried to putting a symbolic breakpoint in the removeObjectsAtIndexes to check if some library (e.g. crash reporter) we use didn't do some implementation swap. There was none, and if anything did some method swizzling, I'd expect that to show in the stack trace before the original code would be called. I did peek into the previous functions and I've noticed a lock used in one of the Vision methods, so in my understanding any data race in this code shouldn't be possible at all. I've also put breakpoints in the NSLock variants, to check for swizzling/override with a category and possibly messing the locking - again, nothing was there. There is also another model that is running on a separate queue, but after seeing the line with the locking in the debugger, it doesn't seem to me like this could cause a problem, at least not in this specific spot. Is there something I'm missing here, or something I'm doing wrong? Thanks in advance for your help!
8
3
830
Jul ’25
tensorflow-metal
Using Tensorflow for Silicon gives inaccurate results when compared to Google Colab GPU (9-15% differences). Here are my install versions for 4 anaconda env's. I understand the Floating point precision can be an issue, batch size, activation functions but how do you rectify this issue for the past 3 years? 1.) Version TF: 2.12.0, Python 3.10.13, tensorflow-deps: 2.9.0, tensorflow-metal: 1.2.0, h5py: 3.6.0, keras: 2.12.0 2.) Version TF: 2.19.0, Python 3.11.0, tensorflow-metal: 1.2.0, h5py: 3.13.0, keras: 3.9.2, jax: 0.6.0, jax-metal: 0.1.1,jaxlib: 0.6.0, ml_dtypes: 0.5.1 3.) python: 3.10.13,tensorflow: 2.19.0,tensorflow-metal: 1.2.0, h5py: 3.13.0, keras: 3.9.2, ml_dtypes: 0.5.1 4.) Version TF: 2.16.2, tensorflow-deps:2.9.0,Python: 3.10.16, tensorflow-macos 2.16.2, tensorflow-metal: 1.2.0, h5py:3.13.0, keras: 3.9.2, ml_dtypes: 0.3.2 Install of Each ENV with common example: Create ENV: conda create --name TF_Env_V2 --no-default-packages start env: source TF_Env_Name ENV_1.) conda install -c apple tensorflow-deps , conda install tensorflow,pip install tensorflow-metal,conda install ipykernel ENV_2.) conda install pip python==3.11, pip install tensorflow,pip install tensorflow-metal,conda install ipykernel ENV_3) conda install pip python 3.10.13,pip install tensorflow, pip install tensorflow-metal,conda install ipykernel ENV_4) conda install -c apple tensorflow-deps, pip install tensorflow-macos, pip install tensor-metal, conda install ipykernel Example used on all 4 env: import tensorflow as tf cifar = tf.keras.datasets.cifar100 (x_train, y_train), (x_test, y_test) = cifar.load_data() model = tf.keras.applications.ResNet50( include_top=True, weights=None, input_shape=(32, 32, 3), classes=100,) loss_fn = tf.keras.losses.SparseCategoricalCrossentropy(from_logits=False) model.compile(optimizer="adam", loss=loss_fn, metrics=["accuracy"]) model.fit(x_train, y_train, epochs=5, batch_size=64)
5
2
1.3k
Oct ’25
RecognizeDocumentsRequest for receipts
Hi, I'm trying to use the new RecognizeDocumentsRequest from the Vision Framework to read a receipt. It looks very promising by being able to read paragraphs, lines and detect data. So far it unfortunately seems to read every line on the receipt as a paragraph and when there is more space on one line it creates two paragraphs. Is there perhaps an Apple Engineer who knows if this is expected behaviour or if I should file a Feedback for this? Code setup: let request = RecognizeDocumentsRequest() let observations = try await request.perform(on: image) guard let document = observations.first?.document else { return } for paragraph in document.paragraphs { print(paragraph.transcript) for data in paragraph.detectedData { switch data.match.details { case .phoneNumber(let data): print("Phone: \(data)") case .postalAddress(let data): print("Postal: \(data)") case .calendarEvent(let data): print("Calendar: \(data)") case .moneyAmount(let data): print("Money: \(data)") case .measurement(let data): print("Measurement: \(data)") default: continue } } } See attached image as an example of a receipt I'd like to parse. The top 3 lines are the name, street, and postal code + city. These are all separate paragraphs. Checking on detectedData does see the street (2nd line) as PostalAddress, but not the complete address. Might that be a location thing since it's a Dutch address. And lower on the receipt it sees the block with "Pomp 1 95 Ongelood" and the things below also as separate paragraphs. First picking up the left side and after that the right side. So it's something like this: * Pomp 1 Volume Prijs € TOTAAL * BTW Netto 21.00 % 95 Ongelood 41,90 l 1.949/ 1 81.66 € 14.17 67.49
3
1
587
Nov ’25
Problem running NLContextualEmbeddingModel in simulator
Environment MacOC 26 Xcode Version 26.0 beta 7 (17A5305k) simulator: iPhone 16 pro iOS: iOS 26 Problem NLContextualEmbedding.load() fails with the following error In simulator Failed to load embedding from MIL representation: filesystem error: in create_directories: Permission denied ["/var/db/com.apple.naturallanguaged/com.apple.e5rt.e5bundlecache"] filesystem error: in create_directories: Permission denied ["/var/db/com.apple.naturallanguaged/com.apple.e5rt.e5bundlecache"] Failed to load embedding model 'mul_Latn' - '5C45D94E-BAB4-4927-94B6-8B5745C46289' assetRequestFailed(Optional(Error Domain=NLNaturalLanguageErrorDomain Code=7 "Embedding model requires compilation" UserInfo={NSLocalizedDescription=Embedding model requires compilation})) in #Playground I'm new to this embedding model. Not sure if it's caused by my code or environment. Code snippet import Foundation import NaturalLanguage import Playgrounds #Playground { // Prefer initializing by script for broader coverage; returns NLContextualEmbedding? guard let embeddingModel = NLContextualEmbedding(script: .latin) else { print("Failed to create NLContextualEmbedding") return } print(embeddingModel.hasAvailableAssets) do { try embeddingModel.load() print("Model loaded") } catch { print("Failed to load model: \(error)") } }
2
2
1.3k
Jan ’26
Tone, Sentiment, language analysis on iPhone - Ideas
Hi everyone, I’m exploring ideas around on-device analysis of user typing behavior on iPhone, and I’d love input from others who’ve worked in this area or thought about similar problems. Conceptually, I’m interested in things like: High-level sentiment or tone inferred from what a user types over time using ML-models Identifying a user’s most important or frequent topics over a recent window (e.g., “last week”) Aggregated insights rather than raw text (privacy-preserving summaries: e.g., your typo-rate by hour to infer highly efficient time slots or "take-a-break" warning typing errors increase) I understand the significant privacy restrictions around keyboard input on iOS, especially for third-party keyboards and system text fields. I’m not trying to bypass those constraints—rather, I’m curious about what’s realistically possible within Apple’s frameworks and policies. (For instance, Grammarly as a correction tool includes some information about tone) Questions I’m thinking through: Are there any recommended approaches for on-device text analysis that don’t rely on capturing raw keystrokes? Has anyone used NLP / Core ML / Natural Language successfully for similar summarization or sentiment tasks, scoped only to user-explicit input? For custom keyboards, what kinds of derived or transient signals (if any) are acceptable to process and summarize locally? Any design patterns that balance usefulness with Apple’s privacy expectations? If you’ve built something adjacent—journaling, writing analytics, well-being apps, etc.—I’d appreciate hearing what worked, what didn’t, and what Apple reviewers were comfortable with. Thanks in advance for any ideas or references 🙏
1
1
610
Feb ’26
Crashed: AXSpeech EXC_BAD_ACCESS KERN_INVALID_ADDRESS 0x000056f023efbeb0
Application is getting Crashed: AXSpeech EXC_BAD_ACCESS KERN_INVALID_ADDRESS 0x000056f023efbeb0 Crashed: AXSpeech 0 libobjc.A.dylib 0x4820 objc_msgSend + 32 1 libsystem_trace.dylib 0x6c34 _os_log_fmt_flatten_object + 116 2 libsystem_trace.dylib 0x5344 _os_log_impl_flatten_and_send + 1884 3 libsystem_trace.dylib 0x4bd0 _os_log + 152 4 libsystem_trace.dylib 0x9c48 _os_log_error_impl + 24 5 TextToSpeech 0xd0a8c _pcre2_xclass_8 6 TextToSpeech 0x3bc04 TTSSpeechUnitTestingMode 7 TextToSpeech 0x3f128 TTSSpeechUnitTestingMode 8 AXCoreUtilities 0xad38 -[NSArray(AXExtras) ax_flatMappedArrayUsingBlock:] + 204 9 TextToSpeech 0x3eb18 TTSSpeechUnitTestingMode 10 TextToSpeech 0x3c948 TTSSpeechUnitTestingMode 11 TextToSpeech 0x48824 AXAVSpeechSynthesisVoiceFromTTSSpeechVoice 12 TextToSpeech 0x49804 AXAVSpeechSynthesisVoiceFromTTSSpeechVoice 13 Foundation 0xf6064 __NSThreadPerformPerform + 264 14 CoreFoundation 0x37acc CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION + 28 15 CoreFoundation 0x36d48 __CFRunLoopDoSource0 + 176 16 CoreFoundation 0x354fc __CFRunLoopDoSources0 + 244 17 CoreFoundation 0x34238 __CFRunLoopRun + 828 18 CoreFoundation 0x33e18 CFRunLoopRunSpecific + 608 19 Foundation 0x2d4cc -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 212 20 TextToSpeech 0x24b88 TTSCFAttributedStringCreateStringByBracketingAttributeWithString 21 Foundation 0xb3154 NSThread__start + 732 com.livingMedia.AajTakiPhone_issue_3ceba855a8ad2d1af83655803dc13f70_crash_session_9081fa41ced440ae9a57c22cb432f312_DNE_0_v2_stacktrace.txt 22 libsystem_pthread.dylib 0x24d4 _pthread_start + 136 23 libsystem_pthread.dylib 0x1a10 thread_start + 8
4
1
1.3k
9h
Unexpected URLRepresentableIntent behaviour
After watching the What's new in App Intents session I'm attempting to create an intent conforming to URLRepresentableIntent. The video states that so long as my AppEntity conforms to URLRepresentableEntity I should not have to provide a perform method . My application will be launched automatically and passed the appropriate URL. This seems to work in that my application is launched and is passed a URL, but the URL is in the form: FeatureEntity/{id}. Am I missing something, or is there a trick that enables it to pass along the URL specified in the AppEntity itself? struct MyExampleIntent: OpenIntent, URLRepresentableIntent { static let title: LocalizedStringResource = "Open Feature" static var parameterSummary: some ParameterSummary { Summary("Open \(\.$target)") } @Parameter(title: "My feature", description: "The feature to open.") var target: FeatureEntity } struct FeatureEntity: AppEntity { // ... } extension FeatureEntity: URLRepresentableEntity { static var urlRepresentation: URLRepresentation { "https://myurl.com/\(.id)" } }
2
1
1.2k
Feb ’26
DockKit .track() has no effect using VNDetectFaceRectanglesRequest
Hi, I'm testing DockKit with a very simple setup: I use VNDetectFaceRectanglesRequest to detect a face and then call dockAccessory.track(...) using the detected bounding box. The stand is correctly docked (state == .docked) and dockAccessory is valid. I'm calling .track(...) with a single observation and valid CameraInformation (including size, device, orientation, etc.). No errors are thrown. To monitor this, I added a logging utility – track(...) is being called 10–30 times per second, as recommended in the documentation. However: the stand does not move at all. There is no visible reaction to the tracking calls. Is there anything I'm missing or doing wrong? Is VNDetectFaceRectanglesRequest supported for DockKit tracking, or are there hidden requirements? Would really appreciate any help or pointers – thanks! That's my complete code: extension VideoFeedViewController: AVCaptureVideoDataOutputSampleBufferDelegate { func captureOutput(_ output: AVCaptureOutput, didOutput sampleBuffer: CMSampleBuffer, from connection: AVCaptureConnection) { guard let frame = CMSampleBufferGetImageBuffer(sampleBuffer) else { return } detectFace(image: frame) func detectFace(image: CVPixelBuffer) { let faceDetectionRequest = VNDetectFaceRectanglesRequest() { vnRequest, error in guard let results = vnRequest.results as? [VNFaceObservation] else { return } guard let observation = results.first else { return } let boundingBoxHeight = observation.boundingBox.size.height * 100 #if canImport(DockKit) if let dockAccessory = self.dockAccessory { Task { try? await trackRider( observation.boundingBox, dockAccessory, frame, sampleBuffer ) } } #endif } let imageResultHandler = VNImageRequestHandler(cvPixelBuffer: image, orientation: .up) try? imageResultHandler.perform([faceDetectionRequest]) func combineBoundingBoxes(_ box1: CGRect, _ box2: CGRect) -> CGRect { let minX = min(box1.minX, box2.minX) let minY = min(box1.minY, box2.minY) let maxX = max(box1.maxX, box2.maxX) let maxY = max(box1.maxY, box2.maxY) let combinedWidth = maxX - minX let combinedHeight = maxY - minY return CGRect(x: minX, y: minY, width: combinedWidth, height: combinedHeight) } #if canImport(DockKit) func trackObservation(_ boundingBox: CGRect, _ dockAccessory: DockAccessory, _ pixelBuffer: CVPixelBuffer, _ cmSampelBuffer: CMSampleBuffer) throws { // Zähle den Aufruf TrackMonitor.shared.trackCalled() let invertedBoundingBox = CGRect( x: boundingBox.origin.x, y: 1.0 - boundingBox.origin.y - boundingBox.height, width: boundingBox.width, height: boundingBox.height ) guard let device = captureDevice else { fatalError("Kamera nicht verfügbar") } let size = CGSize(width: Double(CVPixelBufferGetWidth(pixelBuffer)), height: Double(CVPixelBufferGetHeight(pixelBuffer))) var cameraIntrinsics: matrix_float3x3? = nil if let cameraIntrinsicsUnwrapped = CMGetAttachment( sampleBuffer, key: kCMSampleBufferAttachmentKey_CameraIntrinsicMatrix, attachmentModeOut: nil ) as? Data { cameraIntrinsics = cameraIntrinsicsUnwrapped.withUnsafeBytes { $0.load(as: matrix_float3x3.self) } } Task { let orientation = getCameraOrientation() let cameraInfo = DockAccessory.CameraInformation( captureDevice: device.deviceType, cameraPosition: device.position, orientation: orientation, cameraIntrinsics: cameraIntrinsics, referenceDimensions: size ) let observation = DockAccessory.Observation( identifier: 0, type: .object, rect: invertedBoundingBox ) let observations = [observation] guard let image = CMSampleBufferGetImageBuffer(sampleBuffer) else { print("no image") return } do { try await dockAccessory.track(observations, cameraInformation: cameraInfo) } catch { print(error) } } } #endif func clearDrawings() { boundingBoxLayer?.removeFromSuperlayer() boundingBoxSizeLayer?.removeFromSuperlayer() } } } } @MainActor private func getCameraOrientation() -> DockAccessory.CameraOrientation { switch UIDevice.current.orientation { case .portrait: return .portrait case .portraitUpsideDown: return .portraitUpsideDown case .landscapeRight: return .landscapeRight case .landscapeLeft: return .landscapeLeft case .faceDown: return .faceDown case .faceUp: return .faceUp default: return .corrected } }
1
1
478
Dec ’25
Is there an API for the 3D effect from flat photos?
Introduced in the Keynote was the 3D Lock Screen images with the kangaroo: https://9to5mac.com/wp-content/uploads/sites/6/2025/06/3d-lock-screen-2.gif I can't see any mention on if this effect is available for developers with an API to convert flat 2D photos in to the same 3D feeling image. Does anyone know if there is an API?
1
1
103
Jun ’25
A Summary of the WWDC25 Group Lab - Machine Learning and AI Frameworks
At WWDC25 we launched a new type of Lab event for the developer community - Group Labs. A Group Lab is a panel Q&A designed for a large audience of developers. Group Labs are a unique opportunity for the community to submit questions directly to a panel of Apple engineers and designers. Here are the highlights from the WWDC25 Group Lab for Machine Learning and AI Frameworks. What are you most excited about in the Foundation Models framework? The Foundation Models framework provides access to an on-device Large Language Model (LLM), enabling entirely on-device processing for intelligent features. This allows you to build features such as personalized search suggestions and dynamic NPC generation in games. The combination of guided generation and streaming capabilities is particularly exciting for creating delightful animations and features with reliable output. The seamless integration with SwiftUI and the new design material Liquid Glass is also a major advantage. When should I still bring my own LLM via CoreML? It's generally recommended to first explore Apple's built-in system models and APIs, including the Foundation Models framework, as they are highly optimized for Apple devices and cover a wide range of use cases. However, Core ML is still valuable if you need more control or choice over the specific model being deployed, such as customizing existing system models or augmenting prompts. Core ML provides the tools to get these models on-device, but you are responsible for model distribution and updates. Should I migrate PyTorch code to MLX? MLX is an open-source, general-purpose machine learning framework designed for Apple Silicon from the ground up. It offers a familiar API, similar to PyTorch, and supports C, C++, Python, and Swift. MLX emphasizes unified memory, a key feature of Apple Silicon hardware, which can improve performance. It's recommended to try MLX and see if its programming model and features better suit your application's needs. MLX shines when working with state-of-the-art, larger models. Can I test Foundation Models in Xcode simulator or device? Yes, you can use the Xcode simulator to test Foundation Models use cases. However, your Mac must be running macOS Tahoe. You can test on a physical iPhone running iOS 18 by connecting it to your Mac and running Playgrounds or live previews directly on the device. Which on-device models will be supported? any open source models? The Foundation Models framework currently supports Apple's first-party models only. This allows for platform-wide optimizations, improving battery life and reducing latency. While Core ML can be used to integrate open-source models, it's generally recommended to first explore the built-in system models and APIs provided by Apple, including those in the Vision, Natural Language, and Speech frameworks, as they are highly optimized for Apple devices. For frontier models, MLX can run very large models. How often will the Foundational Model be updated? How do we test for stability when the model is updated? The Foundation Model will be updated in sync with operating system updates. You can test your app against new model versions during the beta period by downloading the beta OS and running your app. It is highly recommended to create an "eval set" of golden prompts and responses to evaluate the performance of your features as the model changes or as you tweak your prompts. Report any unsatisfactory or satisfactory cases using Feedback Assistant. Which on-device model/API can I use to extract text data from images such as: nutrition labels, ingredient lists, cashier receipts, etc? Thank you. The Vision framework offers the RecognizeDocumentRequest which is specifically designed for these use cases. It not only recognizes text in images but also provides the structure of the document, such as rows in a receipt or the layout of a nutrition label. It can also identify data like phone numbers, addresses, and prices. What is the context window for the model? What are max tokens in and max tokens out? The context window for the Foundation Model is 4,096 tokens. The split between input and output tokens is flexible. For example, if you input 4,000 tokens, you'll have 96 tokens remaining for the output. The API takes in text, converting it to tokens under the hood. When estimating token count, a good rule of thumb is 3-4 characters per token for languages like English, and 1 character per token for languages like Japanese or Chinese. Handle potential errors gracefully by asking for shorter prompts or starting a new session if the token limit is exceeded. Is there a rate limit for Foundation Models API that is limited by power or temperature condition on the iPhone? Yes, there are rate limits, particularly when your app is in the background. A budget is allocated for background app usage, but exceeding it will result in rate-limiting errors. In the foreground, there is no rate limit unless the device is under heavy load (e.g., camera open, game mode). The system dynamically balances performance, battery life, and thermal conditions, which can affect the token throughput. Use appropriate quality of service settings for your tasks (e.g., background priority for background work) to help the system manage resources effectively. Do the foundation models support languages other than English? Yes, the on-device Foundation Model is multilingual and supports all languages supported by Apple Intelligence. To get the model to output in a specific language, prompt it with instructions indicating the user's preferred language using the locale API (e.g., "The user's preferred language is en-US"). Putting the instructions in English, but then putting the user prompt in the desired output language is a recommended practice. Are larger server-based models available through Foundation Models? No, the Foundation Models API currently only provides access to the on-device Large Language Model at the core of Apple Intelligence. It does not support server-side models. On-device models are preferred for privacy and for performance reasons. Is it possible to run Retrieval-Augmented Generation (RAG) using the Foundation Models framework? Yes, it is possible to run RAG on-device, but the Foundation Models framework does not include a built-in embedding model. You'll need to use a separate database to store vectors and implement nearest neighbor or cosine distance searches. The Natural Language framework offers simple word and sentence embeddings that can be used. Consider using a combination of Foundation Models and Core ML, using Core ML for your embedding model.
1
0
1.5k
Jun ’25
videotoolbox superresolution
Hello, I'm using videotoolbox superresolution API in MACOS 26: https://developer.apple.com/documentation/videotoolbox/vtsuperresolutionscalerconfiguration/downloadconfigurationmodel(completionhandler:)?language=objc, when using swift, it's ok, when using objective-c, I get error when downloading model with downloadConfigurationModelWithCompletionHandler: [Auto] MA-auto{_failedLockContent} | failure reported by server | error:[com.apple.MobileAssetError.AutoAsset:MissingReference(6111)] [Auto] MA-auto{_failedLockContent} | failure reported by server | error:[com.apple.MobileAssetError.AutoAsset:UnderlyingError(6107)_1_com.apple.MobileAssetError.Download:47] Download completion handler called with error: The operation couldnxe2x80x99t be completed. (VTFrameProcessorErrorDomain error -19743.)
3
1
802
Nov ’25
no tensorflow-metal past tf 2.18?
Hi We're on tensorflow 2.20 that has support now for python 3.13 (finally!). tensorflow-metal is still only supporting 2.18 which is over a year old. When can we expect to see support in tensorflow-metal for tf 2.20 (or later!) ? I bought a mac thinking I would be able to get great performance from the M processors but here I am using my CPU for my ML projects. If it's taking so long to release it, why not open source it so the community can keep it more up to date? cheers Matt
1
1
432
Nov ’25
Is MCP (Model Context Protocol) supported on iOS/macOS?
Hi team, I’m exploring the Model Context Protocol (MCP), which is used to connect LLMs/AI agents to external tools in a structured way. It's becoming a common standard for automation and agent workflows. Before I go deeper, I want to confirm: Does Apple currently provide any official MCP server, API surface, or SDK on iOS/macOS? From what I see, only third-party MCP servers exist for iOS simulators/devices, and Apple’s own frameworks (Foundation Models, Apple Intelligence) don’t expose MCP endpoints. Is there any chance Apple might introduce MCP support—or publish recommended patterns for safely integrating MCP inside apps or developer tools? I would like to see if I can share my app's data to the MCP server to enable other third-party apps/services to integrate easily
1
1
494
Dec ’25
RDMA API Documentation
With the release of the newest version of tahoe and MLX supporting RDMA. Is there a documentation link to how to utilizes the libdrma dylib as well as what functions are available? I am currently assuming it mostly follows the standard linux infiniband library but I would like the apple specific details.
0
1
291
Dec ’25
Selecting GPU for TensorFlow-Metal on Mac Pro (2013) with v0.8.0
Hi everyone, I'm a Mac enthusiast experimenting with tensorflow-metal on my Mac Pro (2013). My question is about GPU selection in tensorflow-metal (v0.8.0), which still supports Intel-based Macs, including my machine. I've noticed that when running TensorFlow with Metal, it automatically selects a GPU, regardless of what I specify using device indices like "gpu:0", "gpu:1", or "gpu:2". I'm wondering if there's a way to manually specify which GPU should be used via an environment variable or another method. For reference, I’ve tried the example from TensorFlow’s guide on multi-GPU selection: https://www.tensorflow.org/guide/gpu#using_a_single_gpu_on_a_multi-gpu_system My goal is to explore performance optimizations by using MirroredStrategy in TensorFlow to leverage multiple GPUs: https://www.tensorflow.org/guide/distributed_training#mirroredstrategy Interestingly, I discovered that the metalcompute Python library (https://pypi.org/project/metalcompute/) allows to utilize manually selected GPUs on my system, allowing for proper multi-GPU computations. This makes me wonder: Is there a hidden environment variable or setting that allows manual GPU selection in tensorflow-metal? Has anyone successfully used MirroredStrategy on multiple GPUs with tensorflow-metal? Would a bridge between metalcompute and tensorflow-metal be necessary for this use case, or is there a more direct approach? I’d love to hear if anyone else has experimented with this or has insights on getting finer control over GPU selection. Any thoughts or suggestions would be greatly appreciated! Thanks!
3
0
318
Mar ’25