Foundation

RSS for tag

Access essential data types, collections, and operating-system services to define the base layer of functionality for your app using Foundation.

Posts under Foundation tag

200 Posts
Sort by:

Post

Replies

Boosts

Views

Activity

Networking Resources
General: TN3151 Choosing the right networking API Networking Overview document — Despite the fact that this is in the archive, this is still really useful. TLS for App Developers DevForums post Choosing a Network Debugging Tool documentation WWDC 2019 Session 712 Advances in Networking, Part 1 — This explains the concept of constrained networking, which is Apple’s preferred solution to questions like How do I check whether I’m on Wi-Fi? TN3135 Low-level networking on watchOS Adapt to changing network conditions tech talk Foundation networking: DevForums tags: Foundation, CFNetwork URL Loading System documentation — NSURLSession, or URLSession in Swift, is the recommended API for HTTP[S] on Apple platforms. Network framework: DevForums tag: Network Network framework documentation — Network framework is the recommended API for TCP, UDP, and QUIC on Apple platforms. Network Extension (including Wi-Fi on iOS): See Network Extension Resources Wi-Fi Fundamentals Wi-Fi on macOS: DevForums tag: Core WLAN Core WLAN framework documentation Wi-Fi Fundamentals Secure networking: DevForums tags: Security Apple Platform Security support document Preventing Insecure Network Connections documentation — This is all about App Transport Security (ATS). Available trusted root certificates for Apple operating systems support article Requirements for trusted certificates in iOS 13 and macOS 10.15 support article About upcoming limits on trusted certificates support article Apple’s Certificate Transparency policy support article Technote 2232 HTTPS Server Trust Evaluation Technote 2326 Creating Certificates for TLS Testing QA1948 HTTPS and Test Servers Miscellaneous: More network-related DevForums tags: 5G, QUIC, Bonjour On FTP DevForums post Using the Multicast Networking Additional Capability DevForums post Investigating Network Latency Problems DevForums post Local Network Privacy FAQ DevForums post Extra-ordinary Networking DevForums post Share and Enjoy — Quinn “The Eskimo!” @ Developer Technical Support @ Apple let myEmail = "eskimo" + "1" + "@" + "apple.com"
0
0
2.2k
Feb ’24
Help Needed: Error Codes in VCPHumanPoseImageRequest.mm[85] and NSArrayM insertObject
Hey all 👋🏼 We're currently working on a video processing project using the Vision framework (face, body and hand pose detection), and We've encountered a couple of errors that I need help with. We are on Xcode 16 Beta 3, testing on an iPhone 14 Pro running iOS 18 beta. The error messages are as follows: [LOG_ERROR] /Library/Caches/com.apple.xbs/Sources/MediaAnalysis/VideoProcessing/VCPHumanPoseImageRequest.mm[85]: code 18,446,744,073,709,551,598 encountered an unexpected condition: *** -[__NSArrayM insertObject:atIndex:]: object cannot be nil What we've tried: Debugging: I’ve tried stepping through the code, but the errors occur before I can gather any meaningful insights. Searching Documentation: Looked through Apple’s developer documentation and forums but couldn’t find anything related to these specific error codes. Nil Check: Added checks to ensure objects are not nil before inserting them into arrays, but the error persists. Here are my questions: Has anyone encountered similar errors with the Vision framework, specifically related to VCPHumanPoseImageRequest and NSArray operations? Is there any known issue or bug in the version of the framework I might be using? Could it also be related to the beta? Are there any additional debug steps or logging mechanisms I can implement to narrow down the cause? Any suggestions on how to handle nil objects more effectively in this context? I would greatly appreciate any insights or suggestions you might have. Thank you in advance for your assistance! Thanks all!
0
0
34
7h
Crash in CAMediaTimingCopyRenderTiming
Hi Team, We are facing crash in CAMediaTimingCopyRenderTiming for production users. And we are unable to trace the crash. Below is the crash stack trace - Crashed: com.apple.main-thread 0 QuartzCore 0x14b9c CAMediaTimingCopyRenderTiming + 660 1 QuartzCore 0xfa9c -[CAAnimation _setCARenderAnimation:layer:] + 64 2 QuartzCore 0x146e4 -[CAAnimationGroup _copyRenderAnimationForLayer:] + 356 3 QuartzCore 0x12f3c CA::Layer::commit_animations(CA::Transaction*, double ()(CA::Layer, double, void*), void ()(CA::Layer, CA::Render::Animation*, void*), void ()(CA::Layer, __CFString const*, void*), CA::Render::TimingList* ()(CA::Layer, void*), void*) + 688 4 QuartzCore 0x277c invocation function for block in CA::Context::commit_transaction(CA::Transaction*, double, double*) + 176 5 QuartzCore 0x482bc CA::Layer::commit_if_needed(CA::Transaction*, void (CA::Layer*, unsigned int, unsigned int) block_pointer) + 384 6 QuartzCore 0x48244 CA::Layer::commit_if_needed(CA::Transaction*, void (CA::Layer*, unsigned int, unsigned int) block_pointer) + 264 7 QuartzCore 0x48244 CA::Layer::commit_if_needed(CA::Transaction*, void (CA::Layer*, unsigned int, unsigned int) block_pointer) + 264 8 QuartzCore 0x48244 CA::Layer::commit_if_needed(CA::Transaction*, void (CA::Layer*, unsigned int, unsigned int) block_pointer) + 264 9 QuartzCore 0x48244 CA::Layer::commit_if_needed(CA::Transaction*, void (CA::Layer*, unsigned int, unsigned int) block_pointer) + 264 10 QuartzCore 0x48244 CA::Layer::commit_if_needed(CA::Transaction*, void (CA::Layer*, unsigned int, unsigned int) block_pointer) + 264 11 QuartzCore 0x48244 CA::Layer::commit_if_needed(CA::Transaction*, void (CA::Layer*, unsigned int, unsigned int) block_pointer) + 264 12 QuartzCore 0x48244 CA::Layer::commit_if_needed(CA::Transaction*, void (CA::Layer*, unsigned int, unsigned int) block_pointer) + 264 13 QuartzCore 0x48244 CA::Layer::commit_if_needed(CA::Transaction*, void (CA::Layer*, unsigned int, unsigned int) block_pointer) + 264 14 QuartzCore 0x48244 CA::Layer::commit_if_needed(CA::Transaction*, void (CA::Layer*, unsigned int, unsigned int) block_pointer) + 264 15 QuartzCore 0x48244 CA::Layer::commit_if_needed(CA::Transaction*, void (CA::Layer*, unsigned int, unsigned int) block_pointer) + 264 16 QuartzCore 0x2e078 CA::Context::commit_transaction(CA::Transaction*, double, double*) + 6224 17 QuartzCore 0x59dc0 CA::Transaction::commit() + 644 18 QuartzCore 0x44dbc CA::Transaction::flush_as_runloop_observer(bool) + 84 19 CoreFoundation 0x898e8 CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION + 32 20 CoreFoundation 0x1951c __CFRunLoopDoObservers + 552 21 CoreFoundation 0x75214 __CFRunLoopRun + 1004 22 CoreFoundation 0x79d20 CFRunLoopRunSpecific + 584 23 GraphicsServices 0x1998 GSEventRunModal + 160 24 UIKitCore 0x371448 -[UIApplication _run] + 868 25 UIKitCore 0x3710c0 UIApplicationMain + 312 26 SwiftUI 0x183c68 OUTLINED_FUNCTION_895 + 2184 27 SwiftUI 0xfdf1c block_copy_helper.1 + 452 28 SwiftUI 0xeaf6c OUTLINED_FUNCTION_901 + 2312 29 Evie Ring 0x2dd20c main + 10 (MovanoRingApp.swift:10) 30 ??? 0x1c7724344 (Missing)
0
0
23
8h
NumberFormat formatting exceeds 16 decimal places exception
Example1: let num = NSDecimalNumber(string: "0.123456789012345678909") let formatter = NumberFormatter() formatter.numberStyle = .decimal formatter.usesGroupingSeparator = true formatter.maximumFractionDigits = 25 formatter.minimumFractionDigits = 25 formatter.minimumIntegerDigits = 1 let str = formatter.string(from: num) ?? "" print(str) output "0.1234567890123460000000000" Example2: let num = NSDecimalNumber(string: "12323.123456789012345678909") let formatter = NumberFormatter() formatter.numberStyle = .decimal formatter.usesGroupingSeparator = true formatter.maximumFractionDigits = 25 formatter.minimumFractionDigits = 25 formatter.minimumIntegerDigits = 1 let str = formatter.string(from: num) ?? "" print(str) output "12,323.1234567890000000000000000" How to correctly format the contents of the above two inputs?
1
0
53
12h
What is the recommended way to count files recursively in a specific folder
Given a directory path (or NSURL) I need to get the total number of files/documents in that directory - recursively - as fast and light as possible. I don't need to list the files, and not filter them. All the APIs I found so far (NSFileManger, NSURL, NSDirectoryEnumerator) collect too much information, and those who are recursive - are aggregating the whole hierarchy before returning. If applied to large directory - this both implies a high CPU peak and slow action, and a huge memory impact - even if transient. My question: What API is best to use to accomplish this count, must I scan recursively the hierarchy? Is there a "lower level" API I could use that is below NSFileManager that provides better performance? One time in the middle-ages, I used old MacOS 8 (before MacOS X) file-system APIs that were immensely fast and allowed doing this without aggregating anything. I write my code in Objective-C, using latest Xcode and MacOS and of course ARC.
7
0
123
1d
PhotoAsset in TagView
I'm trying to recreate the Tag people functionality in Instagram. Where a carousel of media the user has selected is displayed to them. They can then go through and tag people to the media. I'm trying to achieve this (but with food items instead of people) with TagView using PHAssets however the result is some funky behaviour I'm pulling my hair out trying to understand. The items are tagging correctly but the scroll feature on the TabView works sporadically. It occasionally scrolls fine but all of a sudden won't let me scroll past one image.. (See attached video for example). import SwiftUI import Photos struct TagItemView: View { @Binding var selectedAssets: [PHAsset] @State private var showTagSheet = false @State private var currentAsset: PHAsset? { didSet { if let currentAsset = currentAsset { assetTags = tags[currentAsset.localIdentifier] ?? [] } } } @State private var tags: [String: [String]] = [:] // Dictionary to store tags for each media item @State private var assetTags: [String] = [] // Tags for the current asset var body: some View { VStack { mediaCarousel tagsView Spacer() } .background(Color.black.ignoresSafeArea()) .onAppear { if let firstAsset = selectedAssets.first { currentAsset = firstAsset } } .onChange(of: currentAsset) { newAsset in if let currentAsset = newAsset { assetTags = tags[currentAsset.localIdentifier] ?? [] print("currentAsset changed: \(currentAsset.localIdentifier)") print("assetTags: \(assetTags)") } } .sheet(isPresented: $showTagSheet) { TagSheetView(selectedAsset: $currentAsset, tags: $tags, showTagSheet: $showTagSheet, assetTags: $assetTags) } } private var mediaCarousel: some View { VStack { TabView(selection: $currentAsset) { ForEach(selectedAssets, id: \.self) { asset in if asset.mediaType == .image { TagItemImageView(asset: asset) .tag(asset.localIdentifier) .onAppear { currentAsset = asset print("Asset in view (onAppear): \(asset.localIdentifier)") } .onTapGesture { currentAsset = asset showTagSheet = true } } else if asset.mediaType == .video { TagItemVideoView(asset: asset) .tag(asset.localIdentifier) .onAppear { currentAsset = asset print("Asset in view (onAppear): \(asset.localIdentifier)") } .onTapGesture { currentAsset = asset showTagSheet = true } } } } .tabViewStyle(PageTabViewStyle(indexDisplayMode: .always)) .frame(height: UIScreen.main.bounds.height * 0.4) // Fixed height for carousel } } private var tagsView: some View { ScrollView { if !assetTags.isEmpty { ItemView(assetTags: assetTags, removeTag: { tag in removeTag(tag, from: currentAsset!) }) .transition(.opacity) } else { InstructionsView() .transition(.opacity) } } .background(Color.black) .padding(.top, 8) .padding(.horizontal, 15) } private func removeTag(_ tag: String, from asset: PHAsset) { guard var assetTags = tags[asset.localIdentifier] else { return } assetTags.removeAll { $0 == tag } tags[asset.localIdentifier] = assetTags if currentAsset?.localIdentifier == asset.localIdentifier { self.assetTags = assetTags } } }
0
0
74
4d
Can't open file user granted access to.
Our app has a note section that allows you to drag and drop an email to it. Our app then adds a link to the note, that when clicked, will open the email again. Currently andy email dragged from the mail.app doesn't have a problem. Works fine. The issue is with other mail clients at least with Outlook. When a user drags and drops an email from Outlook, we add the link, and if you click the link it will open fine. The problem is that this only works as long as you don't close our app. If you close our app, re-open and click the Outlook email link, we get a permission error. The application “DragAndDropEmails” does not have permission to open “Re- Customize Login- Registration Form.eml.” “NSCocoaErrorDomain” - code: 256 “NSURL” : “file:///Applications/Microsoft%200utlook.app/” “NSLocalizedDescription” : “The application “Microsoft Outlook” could not be launched because a miscellaneous error occurred.” “NSUnderlyingError” : domain: “NSOSStatusErrorDomain” - code: 18446744073709551562 When a drop is made to the text view we check for an email drop like this: private func checkForEmailDrop(_ pasteboardItems: [NSPasteboardItem]?) -> Bool { for item in pasteboardItems ?? [] { for type in item.types { switch type.rawValue { // When using Apple Mail, the following type is returned. case "com.apple.mail.PasteboardTypeMessageTransfer": if let itemURL = item.string(forType: .URL) { if let url = URL(string: itemURL){ // Get the email subject. let subjectName = item.string(forType: .string) self.textStorage?.op1InsertMailMessageLink(withURL: url, subjectText: subjectName) return true } } // When using Outlook, the file promise type is returned and then we must also check to make sure the file is a .eml file (email file). case "com.apple.NSFilePromiseItemMetaData": if let itemFileURL = item.string(forType: .fileURL) { if let itemURL = URL(string: itemFileURL) { if itemURL.pathExtension == "eml" { // Get the email subject. let subjectName = itemURL.deletingPathExtension().lastPathComponent self.textStorage?.op1InsertMailMessageLink(withURL: itemURL, subjectText: subjectName) return true } } } default: break } } } return false } When the user clicks the link, we open it like this: let configuration = NSWorkspace.OpenConfiguration() let urlWithScheme = url.psoAddingSchemeIfNeeded() let appURLWithScheme = appURL.psoAddingSchemeIfNeeded() print(urlWithScheme) print(appURLWithScheme) NSWorkspace.shared.open([urlWithScheme], withApplicationAt: appURLWithScheme, configuration: configuration) { app, error in if let error = error { print("Failed to open link in specific app: \(error.localizedDescription)") } } contents of urlWithScheme: "file:///Users/joseines/Library/Containers/com.microsoft.Outlook/Data/tmp/FB810D5A-D544-46D9-9BD0-65067A3D7DE4/Re-%20Customize%20Login-%20Registration%20Form.eml" contents of appURLWithScheme: file:///Applications/Microsoft%20Outlook.app/ How can we let the system know that the user wants access to this file? How can we open the file after a restart?
1
0
80
3d
SwiftUI URLRequest Warning: "Connection has no local endpoint"
I have a simple SwiftUI application that sends a URLRequest as shown in the code snippet below: import SwiftUI @main struct GOGODemoApp: App { var body: some Scene { WindowGroup { MyView() } } } struct MyView: View { var body: some View { Button("Click") { sendHTTPRequest(to: "https://www.google.com") { code, err in print("Finished, code: \(code ?? -1), err: \(String(describing: err))") } } } } func sendHTTPRequest(to urlString: String, completion: @escaping (Int?, Error?) -> Void) { guard let url = URL(string: urlString) else { completion(nil, NSError(domain: "InvalidURL", code: 0, userInfo: nil)) return } let task = URLSession.shared.dataTask(with: url) { _, resp, error in if let httpResponse = resp as? HTTPURLResponse { completion(httpResponse.statusCode, error) } else { completion(-1, error) } } task.resume() } However, Xcode prints the following warning messages: nw_connection_copy_connected_local_endpoint_block_invoke [C1] Connection has no local endpoint nw_connection_copy_connected_local_endpoint_block_invoke [C1] Connection has no local endpoint nw_connection_copy_connected_local_endpoint_block_invoke [C3] Connection has no local endpoint nw_connection_copy_connected_local_endpoint_block_invoke [C3] Connection has no local endpoint Finished, code: 200, err: nil What does the warning 'Connection has no local endpoint' mean? Thank you for your assistance!
1
0
116
3d
iOS18 beta API
When the usesGroupingSeparator is set to yes on iOS18, the groupingSize value becomes 3. groupingSize is different from 0 in earlier iOS18 versions. Is it a bug or will the subsequent official version also make relevant adjustments? We need to adapt the app in advance。 let formatter = NumberFormatter() let temp = NSNumber(floatLiteral: value) formatter.usesGroupingSeparator = true; print(formatter.string(from: temp) ?? "","--",formatter.groupingSize) Print results below: iOS18 2222222 -- 0 earlier iOS18 2,222,222 -- 3
1
0
157
1w
iOS 18 beta 版本API
iOS18 beta版本,usesGroupingSeparator设置为yes后,groupingSize值变成了3.与iOS18以下groupingSize值为0不一样。是bug还是后续正式版本也做相关调整? let formatter = NumberFormatter() let temp = NSNumber(floatLiteral: value) formatter.usesGroupingSeparator = true; print(formatter.string(from: temp) ?? "","分割位数",formatter.groupingSize) //iOS18以下打印结果:2222222 分割位数 0;iOS18打印结果:2,222,222 分割位数 3
1
0
140
1w
iOS18 usesGroupingSeparator设置为yes后,groupingSize值变成了3.与iOS18以下groupingSize值为0不一样。是bug还是后续正式版本也做相关调整?需要提前适配
iOS18 beta版本,usesGroupingSeparator设置为yes后,groupingSize值变成了3.与iOS18以下groupingSize值为0不一样。是bug还是后续正式版本也做相关调整? let formatter = NumberFormatter() let temp = NSNumber(floatLiteral: value) formatter.usesGroupingSeparator = true; print(formatter.string(from: temp) ?? "","分割位数",formatter.groupingSize) //iOS18以下打印结果:2222222 分割位数 0;iOS18打印结果:2,222,222 分割位数 3
1
0
119
1w
Received termination request from [osservice<com.apple.dasd>:76] on <RBSProcessPredicate <RBSProcessHandlePredicateImpl| app<com.myapp.bundleid() with context <RBSTerminateContext| explanation:BG Kill Demo
App getting terminated as the app enters background state. No crash logs are generated. I have collected this log from Console(Mac app)by connecting iPhone and sending my app to background. There is no meaningful reason or code I can get from the logs. Can you please help me with what does 'explanation:BG Kill Demo ' means ? My app is a VoIP app. App depends on voip apns notifications to receive information about new Voip calls from server. I am posting the logs collected from console app here. default 14:29:55.265590-0400 audiomxd -CMSessionMgr- CMSessionMgrHandleApplicationStateChange: Sending stop command to com.myapp.bundleid with pid '2933' because client is background suspended and there is no AirPlay video session for it default 14:29:55.265753-0400 dasd Received state update for 2933 (app<com.myapp.bundleid(AD9F24FF-321B-48U6-895F-723CDA943372)>, running-suspended-NotVisible default 14:29:55.265908-0400 locationd Received state update for 2933 (app<com.myapp.bundleid(AD9F24FF-321B-48U6-895F-723CDA943372)>, running-suspended-NotVisible default 14:29:55.265994-0400 locationd {"msg":"invoking applicationStateChange handler", "StateChangeData":"{\n BKSApplicationStateAppIsFrontmost = 0;\n BKSApplicationStateExtensionKey = 0;\n SBApplicationStateDisplayIDKey = "com.myapp.bundleid";\n SBApplicationStateKey = 2;\n SBApplicationStateProcessIDKey = 2933;\n SBMostElevatedStateForProcessID = 2;\n}"} default 14:29:55.266083-0400 locationd {"msg":"Post Application State Change Notification", "notification":"BackgroundTaskSuspended", "pid":2933, "bundleId":"com.myapp.bundleid"} default 14:29:55.267019-0400 locationd {"msg":"#CLIUA AppMonitor notification", "notification":"BackgroundTaskSuspended", "pid":2933, "bundleId":"com.myapp.bundleid", "ClientKey":"icom.myapp.bundleid:"} default 14:29:55.267061-0400 locationd {"msg":"skip erasing #CLIUA for RunningBoard Process State. Does not exists", "bundleId":"com.myapp.bundleid"} default 14:29:55.267678-0400 watchdogd Received state update for 2933 (app<com.myapp.bundleid(AD9F24FF-321B-48U6-895F-723CDA943372)>, running-suspended-NotVisible default 14:29:55.267765-0400 useractivityd Received state update for 2933 (app<com.myapp.bundleid(AD9F24FF-321B-48U6-895F-723CDA943372)>, running-suspended-NotVisible default 14:29:55.267934-0400 symptomsd Received state update for 2933 (app<com.myapp.bundleid(AD9F24FF-321B-48U6-895F-723CDA943372)>, running-suspended-NotVisible default 14:29:55.267982-0400 wifid Received state update for 2933 (app<com.myapp.bundleid(AD9F24FF-321B-48U6-895F-723CDA943372)>, running-suspended-NotVisible default 14:29:55.268228-0400 UserEventAgent Received state update for 2933 (app<com.myapp.bundleid(AD9F24FF-321B-48U6-895F-723CDA943372)>, running-suspended-NotVisible default 14:29:55.268275-0400 callservicesd Received state update for 2933 (app<com.myapp.bundleid(AD9F24FF-321B-48U6-895F-723CDA943372)>, running-suspended-NotVisible default 14:29:55.268338-0400 WirelessRadioManagerd Received state update for 2933 (app<com.myapp.bundleid(AD9F24FF-321B-48U6-895F-723CDA943372)>, running-suspended-NotVisible default 14:29:55.269217-0400 runningboardd Acquiring assertion targeting [app<com.myapp.bundleid(AD9F24FF-321B-48U6-895F-723CDA943372)>:2933] from originator [osservice<com.apple.dasd>:76] with description <RBSAssertionDescriptor| "DAS: Application is docked." ID:33-76-44901 target:2933 attributes:[ <RBSDomainAttribute| domain:"com.apple.dasd" name:"DockApp" sourceEnvironment:"(null)"> ]> default 14:29:55.269572-0400 runningboardd Assertion 33-76-44901 (target:[app<com.myapp.bundleid(AD9F24FF-321B-48U6-895F-723CDA943372)>:2933]) will be created as active default 14:29:55.270431-0400 runningboardd [app<com.myapp.bundleid(AD9F24FF-321B-48U6-895F-723CDA943372)>:2933] Set jetsam priority to 30 [0] flag[1] default 14:29:55.270658-0400 runningboardd Calculated state for app<com.myapp.bundleid(AD9F24FF-321B-48U6-895F-723CDA943372)>: running-suspended (role: None) (endowments: (null)) default 14:29:55.273005-0400 runningboardd Received termination request from [osservice<com.apple.dasd>:76] on <RBSProcessPredicate <RBSProcessHandlePredicateImpl| app<com.myapp.bundleid(AD9F24FF-321B-48U6-895F-723CDA943372)>:2933>> with context <RBSTerminateContext| explanation:BG Kill Demo reportType:None maxTerminationResistance:Interactive> default 14:29:55.274715-0400 runningboardd Executing termination request for: <RBSProcessPredicate <RBSProcessHandlePredicateImpl| app<com.myapp.bundleid(AD9F24FF-321B-48U6-895F-723CDA943372)>:2933>> default 14:29:55.275034-0400 runningboardd [app<com.myapp.bundleid(AD9F24FF-321B-48U6-895F-723CDA943372)>:2933] Terminating with context: <RBSTerminateContext| explanation:BG Kill Demo reportType:None maxTerminationResistance:Interactive> default 14:29:55.275122-0400 runningboardd [app<com.myapp.bundleid(AD9F24FF-321B-48U6-895F-723CDA943372)>:2933] terminate_with_reason() success default 14:29:55.275768-0400 SpringBoard [app<com.myapp.bundleid(AD9F24FF-321B-48U6-895F-723CDA943372)>:2933] Workspace connection invalidated. default 14:29:55.275790-0400 SpringBoard [app<com.myapp.bundleid(AD9F24FF-321B-48U6-895F-723CDA943372)>:2933] Now flagged as pending exit for reason: workspace client connection invalidated default 14:29:55.275815-0400 backboardd Connection removed: IOHIDEventSystemConnection uuid:C2525EA6-A052-480B-B83D-4BD62C29C6EC pid:2933 process:MyApp type:Passive entitlements:0x0 caller:BackBoardServices: + 280 attributes:{ HighFrequency = 1; bundleID = "com.myapp.bundleid"; pid = 2933; } state:0x1 events:9 mask:0x800 dropped:0 dropStatus:0 droppedMask:0x0 lastDroppedTime:NONE default 14:29:55.275988-0400 backboardd Removing client connection <BKHIDClientConnection: 0xd43cd1f40; IOHIDEventSystemConnectionRef: 0xd415d5800; vpid: 2933(v1C3E); taskPort: 0x84D8B; bundleID: com.myapp.bundleid> for client: IOHIDEventSystemConnection uuid:C2525EA6-A052-480B-B83D-4BD62C29C6EC pid:2933 process:MyApp type:Passive entitlements:0x0 caller:BackBoardServices: + 280 attributes:{ HighFrequency = 1; bundleID = "com.myapp.bundleid"; pid = 2933; } state:0x1 events:9 mask:0x800 dropped:0 dropStatus:0 droppedMask:0x0 lastDroppedTime:NONE source:HID default 14:29:55.288098-0400 runningboardd [app<com.myapp.bundleid(AD9F24F321B-48U6C7-895F-723CDA943372)>:2933] termination reported by launchd (15, 0, 9) default 14:29:55.289192-0400 runningboardd Removing process: [app<com.myapp.bundleid(AD9F24F321B-48U6C7-895F-723CDA943372)>:2933] default 14:29:55.289331-0400 runningboardd Removing launch job for: [app<com.myapp.bundleid(AD9F24F321B-48U6C7-895F-723CDA943372)>:2933] default 14:29:55.289582-0400 runningboardd Removed job for [app<com.myapp.bundleid(AD9F24F321B-48U6C7-895F-723CDA943372)>:2933] default 14:29:55.289706-0400 runningboardd Removing assertions for terminated process: [app<com.myapp.bundleid(AD9F24F321B-48U6C7-895F-723CDA943372)>:2933]
3
0
196
3d
Unarchiving an object with custom classes
I have a custom class named CodeReadModel, which contains another custom class named CodeDataModel. The former contains the latter as an array like the following. class CodeReadModel: NSObject, NSSecureCoding { class var supportsSecureCoding: Bool { true } let identifier: String let codeDataModels: [CodeDataModel] init(identifier: String, codeDataModels: [CodeDataModel]) { self.identifier = identifier self.codeDataModels = codeDataModels } required init(coder decoder: NSCoder) { self.identifier = decoder.decodeObject(forKey: "identifier") as! String self.codeDataModels = decoder.decodeObject(forKey: "codeDataModels") as! [CodeDataModel] } func encode(with coder: NSCoder) { coder.encode(identifier, forKey: "identifier") coder.encode(codeDataModels, forKey: "codeDataModels") } } And I want to unarchive an object with the following. func importCodeReaderSnippetNext(fileURL: URL) { do { NSKeyedUnarchiver.setClass(CodeReadModel.self, forClassName: "CodeReadModel") NSKeyedUnarchiver.setClass(CodeDataModel.self, forClassName: "CodeDataModel") let data = try! Data(contentsOf: fileURL) if let codeReadModel = try NSKeyedUnarchiver.unarchivedObject(ofClass: CodeReadModel.self, from: data) { } } catch { print("Error: \(error.localizedDescription)") } } And I will get an error because codeReadModel contains another custom class, which cannot be decoded. How can I resolve this problem? Muchas thankos.
7
0
176
1w
python "import foundation" crushes if the app is codesigned
Hi, python "import foundation" crushes without error message (but with a macos crush report) if the app is codesigned with Developer ID Application Certificate.(Without codesign, it works fine.) 1-test_simple_foundation.py(already attached): import socket import Foundation print("hallo") 2-Install Nuitka: pip install Nuitka 3-Generate App File via Nuitka: echo *** | sudo -S python3.9 -m nuitka --run --standalone --macos-create-app-bundle --macos-app-mode=ui-element --macos-app-icon=icons/app_icon.png --include-data-dir=icons=icons test_simple_foundation.py 4-Copy app file under /applications 5-Execute test_simple_foundation.app file from terminal ./Applications/test_simple_foundation.app/Contents/MacOS/test_simple_foundation and observer that "hallo" is printed out 6-Codesign with following sh file(already attached): 7-Execute test_simple_foundation.app file from terminal ./Applications/test_simple_foundation.app/Contents/MacOS/test_simple_foundation and observer that code freezes with a macos crush report(already attached), after import Foundation nothing printed out. MacOS_crush_report.txt build-app_no_sand-sh.txt test_simple_foundation-py.txt pip list freeze.txt app.entitlements.txt Requirement: python3.9 -m nuitka --version 1.9rc5 Commercial: None Python: 3.9.12 (v3.9.12:b28265d7e6, Mar 23 2022, 18:22:40) Flavor: CPython Official Executable: /Library/Frameworks/Python.framework/Versions/3.9/bin/python3.9 OS: Darwin Arch: x86_64 Version C compiler: /usr/bin/clang (clang). MacOS: Sonoma 14.2.1 1,6 GHz Dual-Core Intel Core i5 8 GB 2133 MHz LPDDR3
2
0
195
1w
Bug in Calendar.date(from:) in iOS 18? It is now underspecified with year, weekOfYear, and yearForWeekOfYear?
One of our apps has some failing unit tests that I traced back to a change in the way Calendar.date(from:) works on iOS 18 beta (22A5307d) as compared to earlier versions. The simple demo unit test below passes in iOS 17.5 and fails in 18 beta 3. I did not test this in other beta versions. import XCTest final class DateComponentsMath_Tests: XCTestCase { func testAddingWeek() throws { var components = DateComponents( year: 2024, weekOfYear: 1, yearForWeekOfYear: 2024 ) let date1 = Calendar.current.date(from: components)! // add a few weeks to the components components.weekOfYear = components.weekOfYear! + 5 let date2 = Calendar.current.date(from: components) XCTAssertNotEqual(date1, date2, "We added five weeks to the components so this should not result in the same date") } } It appears that in iOS 18 (22A5307d), year, weekOfYear, and yearForWeekOfYear are no longer enough to uniquely specify a date. With those three values, Calendar.date(from:) always returns January 1 of the specified year. In earlier versions of iOS this was not the case. I submitted this as FB14323984
4
0
205
1w
Attachment is displayed incorrectly
In the recent MacOS Sequoia Beta 3 NSTextAttachment initialized with custom data and an Image cell as attachmentCell are shown as a file icon istead of the image cell. I am creating a NSAttributedString and showing it in NSTextView like this: NSTextAttachment *attachment = [[NSTextAttachment alloc] initWithData:[text dataUsingEncoding:NSUTF8StringEncoding] ofType:nil]; attachment.attachmentCell = [[NSTextAttachmentCell alloc] initImageCell:img]; NSMutableAttributedString *res = [[NSMutableAttributedString alloc] initWithAttributedString:[NSAttributedString attributedStringWithAttachment:attachment]]; ...
0
0
139
1w
The watchOS support of NSValue.CGSizeValue
Starting from Xcode 16 Beta 2, NSValue.CGSizeValue is no longer available on watchOS, whereas this method was supported in previous versions of Xcode. The Xcode header files mark this method as unavailable on watchOS, but after manually modifying the Xcode files to remove the unavailable macro, the code compiles and runs normally. Is there a change in this API that makes it unsupported on watchOS, or is this an error? Previously, I submitted feedback FB14072192, and the status of this feedback was updated to "Unable to diagnose with current information" without any further response. If this is indeed an issue, I hope it can be fixed.
2
1
231
1w
Network Connection on watchOS App
I am developing a watchOS-only app, and whenever I attempt to make a network request, it always fails and throws the following error: Error Domain=NSURLErrorDomain Code=-1009 "The Internet connection appears to be offline." I noticed that when I turn off Wi-Fi and Bluetooth in the settings of the iPhone paired with the Apple Watch (thus disconnecting the Apple Watch from the iPhone), my app can successfully connect to the network. Additionally, when the app contains both an iOS app and a watchOS app, after granting network permissions on the iOS app, the watchOS app can access the network normally when connected to the iPhone. When opening some system apps on the Apple Watch (such as the "Workout" app), the app will display a network permission request similar to that on iOS, but this request does not automatically pop up when my watchOS app attempts to access the network. Is there a way to request network permissions in a watchOS-only app so that it can access the network while connected to the iPhone?
1
0
204
2w