Delve into the world of built-in app and system services available to developers. Discuss leveraging these services to enhance your app's functionality and user experience.

Post

Replies

Boosts

Views

Activity

macOS keeps showing "[App] would like to access data from other apps" warning even if accepting it each time
It seems that whenever I scan the contents of ~/Library/Containers with my app, I get the warning [App] would like to access data from other apps, regardless of how often I have already allowed it. When the warning appears, the last scanned file is ~/Library/Containers/com.apple.CloudPhotosConfiguration/Data. My sample code: let openPanel = NSOpenPanel() openPanel.canChooseDirectories = true openPanel.runModal() let url = openPanel.urls[0] let enumerator = FileManager.default.enumerator(at: url, includingPropertiesForKeys: nil) while let url = enumerator?.nextObject() as? URL { print(url.path) } Is it expected that one has to allow this warning every time the app is run?
9
0
3.7k
Nov ’23
Xcode downloads client crash reports for string interpolation (_StringGuts.append)
Xcode contains several crash reports downloaded from users of my app. Thread 1 apparently crashes while performing a string interpolation. All the other threads only contain calls to system code. The String.appendingPathComponent(_:) that appears in the stacktrace is defined as follows: extension String { func appendingPathComponent(_ pathComponent: String) -> String { return pathComponent == "" ? self : self == "" || self == "/" ? "\(self)\(pathComponent)" : "\(self)/\(pathComponent)" } } What could cause such a crash? Thread 1 Crashed: 0 CoreFoundation 0x00007ff81566f9df __CFStringEncodeByteStream + 120 (CFStringEncodings.c:692) 1 Foundation 0x00007ff8164c95aa -[NSString(NSStringOtherEncodings) getBytes:maxLength:usedLength:encoding:options:range:remainingRange:] + 204 (NSStringEncodings.m:341) 2 libswiftCore.dylib 0x00007ff822c6c1e0 String.UTF8View._foreignDistance(from:to:) + 208 (StringUTF8View.swift:507) 3 libswiftCore.dylib 0x00007ff822c56715 _StringGuts.append(_:) + 1445 (StringGutsRangeReplaceable.swift:191) 4 MyApp 0x00000001010c3c0f String.appendingPathComponent(_:) + 15 (<compiler-generated>:0)
6
0
582
Nov ’23
apple login TypeError
hello. I am using the app with webview. When I log in to Apple, a typeerror appears. How can I solve this? TypeError: this.attr(...).serialize is not a function at u.get (https://appleid.cdn-apple.com/appleauth/static/jsj/N1506946403/profile/app.js:691:77511) at t.getValueAndBind (https://appleid.cdn-apple.com/appleauth/static/jsj/N1506946403/profile/app.js:145:1485) at e.Compute._on (https://appleid.cdn-apple.com/appleauth/static/jsj/N1506946403/profile/app.js:311:3608) at e.Compute.<anonymous> (https://appleid.cdn-apple.com/appleauth/static/jsj/N1506946403/profile/app.js:311:2378) at e.Compute._bindsetup (https://appleid.cdn-apple.com/appleauth/static/jsj/N1506946403/profile/app.js:145:3277) at e.bindAndSetup [as bind] (https://appleid.cdn-apple.com/appleauth/static/jsj/N1506946403/profile/app.js:131:200) at e.Compute.temporarilyBind (https://appleid.cdn-apple.com/appleauth/static/jsj/N1506946403/profile/app.js:311:3888) at e.Compute.get (https://appleid.cdn-apple.com/appleauth/static/jsj/N1506946403/profile/app.js:311:2827) at Object.u [as compute] (https://appleid.cdn-apple.com/appleauth/static/jsj/N1506946403/profile/app.js:117:194) at u.___get (https://appleid.cdn-apple.com/appleauth/static/jsj/N1506946403/profile/app.js:59:1930) TypeError: Cannot read properties of undefined (reading 'serialize') at u.inserted (https://appleid.cdn-apple.com/appleauth/static/jsj/N1506946403/profile/app.js:691:116897) at HTMLElement.<anonymous> (https://appleid.cdn-apple.com/appleauth/static/jsj/N1506946403/profile/app.js:187:673) at HTMLElement.dispatch (https://appleid.cdn-apple.com/appleauth/static/jsj/N1506946403/profile/app.js:248:39204) at v.handle (https://appleid.cdn-apple.com/appleauth/static/jsj/N1506946403/profile/app.js:248:37199) at Object.trigger (https://appleid.cdn-apple.com/appleauth/static/jsj/N1506946403/profile/app.js:248:67752) at Object.trigger (https://appleid.cdn-apple.com/appleauth/static/jsj/N1506946403/profile/app.js:224:258) at e.inserted (https://appleid.cdn-apple.com/appleauth/static/jsj/N1506946403/profile/app.js:290:412) at t.each.e.fn.<computed> [as append] (https://appleid.cdn-apple.com/appleauth/static/jsj/N1506946403/profile/app.js:224:2129) at O.fn.init.<anonymous> (https://appleid.cdn-apple.com/appleauth/static/jsj/N1506946403/profile/app.js:248:46985) at W (https://appleid.cdn-apple.com/appleauth/static/jsj/N1506946403/profile/app.js:248:28565)
0
0
721
Nov ’23
What is the max limit of Universal Links registration
Problems I would like to know the max limit registrations of Universal Links. There is no information about the limit in the latest documents, how many links we can register. Background Now we consider introducing UniversalLinks to our application and one of the requirements is registering multiple domains. In the system's specifications, there is no upper limit. References Supporting associated domains https://developer.apple.com/documentation/xcode/supporting-associated-domains Associated Domains Entitlement https://developer.apple.com/documentation/bundleresources/entitlements/com_apple_developer_associated-domains Support Universal Links(Documentation Archive) https://developer.apple.com/library/archive/documentation/General/Conceptual/AppSearch/UniversalLinks.html Archived documents say as follows but I don't know this is a reliable resource. In your com.apple.developer.associated-domains entitlement, include a list of the domains that your app wants to handle as universal links. To do this in Xcode, open the Associated Domains section in the Capabilities tab and add an entry for each domain that your app supports, prefixed with applinks:, such as applinks:hogehoge. Limit this list to no more than about 20 to 30 domains.
0
1
524
Nov ’23
[iOS 17.1.1 issue] MSMessageLiveLayout not rendering after MSMessagesAppViewController.willBecomeActive in iOS 17.1.1
Hello dear community, I have an iMessage extension running perfectly on iOS 16.4, but on 17.0.1 and 17.1.1 it's having real issues. Messaging in iMessage on the iOS 17.0.1 simulator isn't working at all. MSMessageLiveLayout works perfectly on iOS 16.4, but on iOS 17.1.1 (physical iPhone 15, 14, 13, 12, SE 2020) the MSMessagesAppViewController won't render after didStartSending and subsequent willBecomeActive. The iPhones will just show "Loading...". I debugged through it, couldn't find any issues and works perfectly fine on iOS 16.4 both in the simulator and on a physical device. I'm debugging through the physical devices with XCode, but couldn't find any root cause on why. Has anyone experienced similar issues with MSMessagesAppViewController in iOS 17.1.1? Any ideas on how to fix this? Thanks, Jan
1
0
496
Nov ’23
Returning a type from an Intent (basics)
Hello, I'm attempting to learn the basics of AppIntents. My test Hello World intent takes a number and doubles it. This page (https://developer.apple.com/documentation/appintents/providing-your-app-s-capabilities-to-system-services) seems to imply that you can return types from the perform() function. My code compiles, but crashes at runtime with the error perform() returned types not declared in method signature - Did not declare ReturnsValue but provided one Code: struct DoubleANumber: AppIntent { static var title: LocalizedStringResource = "Double a number" static var description = IntentDescription("Given a number, gives back twice that number.") @Parameter(title: "Start Number") var inputNumber: Double static var parameterSummary: some ParameterSummary { Summary("The number to double") } func perform() async throws -> some IntentResult & ReturnsValue { let outputNumber = inputNumber * 2 return .result(value: outputNumber) } } The value returned in the value property of the IntentResult is a Double. I would have assumed that this would be a valid primitive type (as mentioned in the earlier section of that docs page, covering parameters) and that the actual type returned is the wrapper .result type would be covered in the type in the method signature some IntentResult & ReturnsValue What am I missing? Thanks.
2
0
712
Nov ’23
ETA panel and Manoeuvres not showing if disconnect and connect CarPlay
We have an app with CarPlay support. There you can preview a trip and start it. However, if we start a trip (see eta and manoeuvres), then turn off the car (or tap disconnect in CarPlay Simulator), then turn it again - CarPlay launched, but there's no eta panel and manoeuvres in it. Even if cancel this trip and start new. Only after relaunch the app eta and manoeuvres appear again. Is someone experienced something similar? Maybe this is because some misunderstunding in CarPlay workflow?
1
0
572
Nov ’23
Recognize watchOS10 finger double-tap gesture
Apple Watch Ultra 2, watchOS 10.2 I'm trying to recognize a finger double-tap gesture in watchOS 10.2 on an Apple Watch Ultra 2 or Apple Watch 9. Apple indicates watchOS will invoke primary watch button of app, but I don't know how to specify button as primary. I've written two small watchOS 10.2 SwiftUI apps to demonstrate the problem. Does anyone see what I'm missing, or can point me to relevant docs? APP #1 - simple one-button tap app. Touching button works, but double tap finger gesture seems recognized by watchOS as blue finger icon appears on top of watch display, shaking back and forth indicating it doesn't know what to do, but doesn't invoke Say Hello button. import SwiftUI struct ContentView: View { // Controls whether You did it message is shown @State private var showingSuccessMessage = false var body: some View { VStack { Button("Say Hello") { // This closure is the primary action for the button showingSuccessMessage = true // After 3 seconds, hide the success message DispatchQueue.main.asyncAfter(deadline: .now() + 3) { showingSuccessMessage = false } } // Toggle the visibility of the success message if showingSuccessMessage { Text("You Did It") } } .padding() } } #Preview { ContentView() } APP #2 - basically same app with tap gesture recognizer. Single touch of text works, but double tap gesture while seemingly recognized by watchOS as blue finger icon appears on top of watch display, shaking back and forth indicating it doesn't know what to do, also won't invoke a touch of the Say Hello text. import SwiftUI struct ContentView: View { @State private var showingSuccessMessage = false var body: some View { VStack { // The view that responds to the tap gesture Text("Tap to Say Hello") .padding() .background(Capsule().fill(Color.orange)) .foregroundColor(.white) .onTapGesture { // The action to perform on tap showingSuccessMessage = true // After 3 seconds, hide the success message DispatchQueue.main.asyncAfter(deadline: .now() + 3) { showingSuccessMessage = false } } // Toggle the visibility of the success message if showingSuccessMessage { Text("You did it") } } } } #Preview { ContentView() }
1
2
894
Nov ’23
PKToolPicker Available Tools
When I display the PKToolPicker in my app it looks similar to the image below If you use one of the apps from Apple like Pages or Freeform you see a picker similar to this one. Notice that the PKToolPicker from the Apple app has 6 tools not including the ruler. With the tool all the way to the left being the writing tool. How do you get the picker to display with the writing tool? I have looked over the API and I can see where you can set if the ruler is displayed or not but I can't find anything for the writing tool
1
0
844
Nov ’23
Unable to log in to Apple Developer account
I get the message "Review the license agreement. To continue your enrollment, review and accept the Program License Agreement" at the top of my Account screen. But when I try to click on this and sign in, it keeps looping. I sign in and it brings me back to the sign in page. Over and over. I tried calling Apple Support, and they told me to contact developer support. Which I would only be able to contact if I could log in. But I can't. I'm stuck in a loop.
2
2
413
Nov ’23
iOS System Network Library Crash
We are an SDK manufacturer, providing our clients with an HTTP network proxy SDK. Recently on iOS 17.1.1 version, a problem was encountered. After the proxy is started, the system is prone to crash, which looks like a crash in the iOS network library. The crash information is as follows: In other versions of iOS (15, 16) etc., I would like to ask whether the cause of the crash can be seen from the information provided? Is it an issue on our side, or a BUG in the iOS system?
8
0
1.4k
Nov ’23
Screen Time Api
Hi Folks, How to sheild or lock the apps in childs phone from the Guardians Phone. I got the opaque tokens from childs phone , but on the parents device there are only categories options but not the applications. so how to get the applications in parentsl device . when i try to authorisee the family controls with .individual option there are not the applications in family activity picker but only the categories and others. Thanks in advance
0
0
431
Nov ’23
Seemingly incorrect NSTextLineFragments generated with custom subclass to NSTextContentManager
I have a custom subclass to a NSTextContentManager which provides NSTextParagrahs for layout. However, when I have a trailing newline in my content string, the NSTextLayoutFragment does not have a empty NSTextLineFragment indicating a new line. This is in contrast to using the standard NSTextContentStorage. NSTextContentStorage also uses NSTextParagraphs to represent it's text elements. The code I have for both scenarios are Using Default NSTextContentStorage let layoutManager = NSTextLayoutManager() let container = NSTextContainer(size: NSSize(width: 400, height: 400)) layoutManager.textContainer = container let contentStorage = NSTextContentStorage() contentStorage.textStorage?.replaceCharacters(in: NSRange(location: 0, length: 0), with: "It was the best of times.\n") contentStorage.addTextLayoutManager(layoutManager) layoutManager.enumerateTextLayoutFragments(from: contentStorage.documentRange.location, options: .ensuresLayout) { textLayoutFragment in print("defaultTextLineFragments:") for (index, textLineFragment) in textLayoutFragment.textLineFragments.enumerated() { print("\(index): \(textLineFragment)") } print("\n") return true } This outputs defaultTextLineFragments: 0: <NSTextLineFragment: 0x123815a80 "It was the best of times. "> 1: <NSTextLineFragment: 0x123825b00 ""> Using custom subclass to NSTextContentManager class CustomTextLocation: NSObject, NSTextLocation { let offset: Int init(offset: Int) { self.offset = offset } func compare(_ location: NSTextLocation) -> ComparisonResult { guard let location = location as? CustomTextLocation else { return .orderedAscending } if offset < location.offset { return .orderedAscending } else if offset > location.offset { return .orderedDescending } else { return .orderedSame } } } class CustomStorage: NSTextContentManager { let content = "It was the best of times.\n" override var documentRange: NSTextRange { NSTextRange(location: CustomTextLocation(offset: 0), end: CustomTextLocation(offset: content.utf8.count))! } override func textElements(for range: NSTextRange) -> [NSTextElement] { let paragraph = NSTextParagraph(attributedString: NSAttributedString(string: content)) paragraph.textContentManager = self paragraph.elementRange = documentRange return [paragraph] } override func enumerateTextElements(from textLocation: NSTextLocation?, options: NSTextContentManager.EnumerationOptions = [], using block: (NSTextElement) -> Bool) -> NSTextLocation? { // Just assuming static text elements for this example let elements = self.textElements(for: documentRange) for element in elements { block(element) } return elements.last?.elementRange?.endLocation } override func location(_ location: NSTextLocation, offsetBy offset: Int) -> NSTextLocation? { guard let location = location as? CustomTextLocation, let documentEnd = documentRange.endLocation as? CustomTextLocation else { return nil } let offset = CustomTextLocation(offset: location.offset + offset) if offset.compare(documentEnd) == .orderedDescending { return nil } return offset } override func offset(from: NSTextLocation, to: NSTextLocation) -> Int { guard let from = from as? CustomTextLocation, let to = to as? CustomTextLocation else { return 0 } return to.offset - from.offset } } let customLayoutManager = NSTextLayoutManager() let customContainer = NSTextContainer(size: NSSize(width: 400, height: 400)) customLayoutManager.textContainer = customContainer let customStorage = CustomStorage() customStorage.addTextLayoutManager(customLayoutManager) customLayoutManager.enumerateTextLayoutFragments(from: customStorage.documentRange.location, options: .ensuresLayout) { textLayoutFragment in print("customStorage textLineFragments:") for (index, textLineFragment) in textLayoutFragment.textLineFragments.enumerated() { print("\(index): \(textLineFragment)") } print("\n") return true } This output customStorage textLineFragments: 0: <NSTextLineFragment: 0x13ff0c8d0 "It was the best of times. "> I am expecting the two outputs to match (as it's impacting my position calculations for carets during text entry). How would I go about getting the text layout manager to add the extra line fragment while using a custom NSTextContentManager
0
0
542
Nov ’23
CMIO Camera Extension and debug log
I made s target of "Camera Extension" on Xcode macOS Swift app. I got Swift code with CMIOExtensionDeviceSource. I add NSLog() and String.write() to file under FileManager.default.temporaryDirectory. My camera extension installaion was success and running with FaceTime. But I cannot see NSLog output or debug output temp file on Xcode or Console. How can I see debug output from my Camera Extension?
2
0
928
Nov ’23
How to read Mifare Classic 1k ISO 14443-3A card details?
Developing an application to read card details using NFC. Actually, it's a cross-platform (MAUI) app, but it implements the code in native. ISO 14443-4 cards are working fine when tap a card "DidDetectTags" method hitting. For the mentioned Mifare card it's not working. Tried in NFCTagReaderSessionDelegate and NFCNDEFReaderSessionDelegate. Also in the info.plist configured below keys <key>com.apple.developer.nfc.readersession.iso7816.select-identifiers</key> <array> <string></string> //Confirured more than 200+ keys </array> <key>com.apple.developer.nfc.readersession.formats</key> <array> <string>TAG</string> <string>NDEF</string> </array> Testing device : iPhone 7 plus, iOS : 15.8 I am suspecting selector identifier may not configured correctly for mifare classic 1k card, can anyone help me on this what i am missing?
1
0
1.1k
Nov ’23