Attempting to recreate PKDrawing point-by-point using an existing drawing instance results in .pencil strokes being displayed with different (thinner) width than the original.
Strokes with all other inks are restored fully visually identically to the original.
This can be observed from iOS 15.2 to iOS 18 beta 5.
Code used to remake the drawing:
let restoredDrawing = PKDrawing(strokes: drawing.strokes.map { stroke in
PKStroke(
ink: stroke.ink,
path: PKStrokePath(controlPoints: (0..<stroke.path.count).map { controlIndex in
// This could be replaced with stroke.path.map { point in }
let point = Array(stroke.path)[controlIndex]
// This does not result in the same presentation as the point
let restoredPoint: PKStrokePoint
if #available(iOS 17.0, *) {
restoredPoint = PKStrokePoint(
location: point.location,
timeOffset: point.timeOffset,
size: point.size,
opacity: point.opacity,
force: point.force,
azimuth: point.azimuth,
altitude: point.altitude,
secondaryScale: point.secondaryScale
)
} else {
restoredPoint = PKStrokePoint(
location: point.location,
timeOffset: point.timeOffset,
size: point.size,
opacity: point.opacity,
force: point.force,
azimuth: point.azimuth,
altitude: point.altitude
)
}
// Even this produces correct result:
// let restoredPoint = stroke.path.interpolatedPoint(at: CGFloat(controlIndex))
compare(point, restoredPoint)
return restoredPoint
},
creationDate: stroke.path.creationDate),
transform: stroke.transform,
mask: stroke.mask
)
})
Gist with ViewController with side-by-side to paste into new project: https://gist.github.com/ilevIO/a1dea60ab6cb16047de2b421897d30f1
General
RSS for tagDelve 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
I am developing a file provider extension on Mac.
I noticed when attempting to delete an enumerated folder with didDeleteItems, passing only the top-level folder's ID is not enough to delete the item. It seems we need to pass all items underneath as well to this function for the folder to be removed.
Is there a way around this? The way our application is designed makes it challenging to do this and we would prefer being able to remove the folder by utilizing the item ID only.
If not, how could we obtain the particular items underneath that should be passed in to the function?
We use a credit card processing app in conjunction with a data base. when you navigate to the app in settings we can change the host and file name for the redirect. it works perfectly in IOS17 but not available in IOS18. This is defiantly an iOS issue because I have found the same issue in another up that uses these same setting, they are missing too in IOS.
Hello. We are using Twilio Video SDK and CallKit to report an incoming invite to join a video room.
On iOS 18 trying to decline a call invite via headphones (long pressing the accept button) doesn't actually result in the call being declined.
There seem to be different results depending on the device being used. When using Apple EarPods with Lightning connector or a Bluetooth JBL headset, the call is declined only on a second attempt. When using a Bluetooth Jabra BT2046 headset, the call gets accepted instead on the first decline attempt.
This issue is not reproducible on iOS 17.
We have an app that captures images and videos and we share them to a server. Now at initial state the app works fine, but as we start using the app, the memory grows and my app crashes finally. Kindly help in identifying how to rectify and remove the resident memory and dirty memory.
Returning false from NSTextContentManagerDelegate.textContentManager(_:shouldEnumerate:options:) produces huge gaps in my layout instead of showing a continuous block of text.
Instead of omiting the layout of the hidden element, there is a blank space that shows that appears to have the same size in layout as the omitted text element.
Why is this happening and how can I prevent this?
Example:
Hello
After updating my/our devices to iOS 17 (or XCode 15, not entirely sure), the custom fonts in our application have started randomly not working. Usually it will happen after the app has been in the background for a while.
What happens is that:
The fonts either don't load at all. For icon fonts, this means a lot of question marks.
The fonts get swapped around, meaning regular text (Roboto, custom font) starts rendering using the icon font (Font Awesome). I can tell because I recognize the font from development.
I have no idea how to reproduce it. I tried simulating the memory warning on the simulator, but that doesn't trigger it. It did not happen when building for iOS 16 and I did not change any font logic since then. It still does not happen on devices running iOS 17 but on versions of the app built with XCode 14.
Some debug info:
XCode: 15.0.1 (15A507)
iOS: 17.1.1 (real device, I have not observed it on Simulator)
We load the custom fonts from a proprietary SPM package:
fileprivate static func registerFont(fontName: String, ext: String = "otf") {
guard let fontURL = Bundle.module.url(forResource: fontName, withExtension: ext),
let fontDataProvider = CGDataProvider(url: fontURL as CFURL),
let font = CGFont(fontDataProvider) else {
fatalError("Couldn't create font from filename: \(fontName).\(ext)")
}
var error: Unmanaged<CFError>?
CTFontManagerRegisterGraphicsFont(font, &error)
}
public static func registerFonts() {
registerFont(fontName: "Font Awesome 6 Brands-Regular-400")
registerFont(fontName: "Font Awesome 6 Duotone-Solid-900")
registerFont(fontName: "Font Awesome 6 Pro-Light-300")
registerFont(fontName: "Font Awesome 6 Pro-Regular-400")
registerFont(fontName: "Font Awesome 6 Pro-Solid-900")
registerFont(fontName: "Font Awesome 6 Pro-Thin-100")
registerFont(fontName: "Font Awesome 6 Sharp-Light-300")
registerFont(fontName: "Font Awesome 6 Sharp-Regular-400")
registerFont(fontName: "Font Awesome 6 Sharp-Solid-900")
registerFont(fontName: "Roboto-Medium", ext: "ttf")
registerFont(fontName: "Roboto-Regular", ext: "ttf")
registerFont(fontName: "RobotoMono-Regular", ext: "ttf")
}
// Similar methods for all font types and icons:
@objc public static func getDefaultFont(size: CGFloat) -> UIFont {
return UIFont.init(name: "Roboto-Regular", size: size) ?? UIFont.systemFont(ofSize: size);
}
This code is the called in didFinishLaunching, and it would crash the app if it failed:
FontHandler.registerFonts()
To reiterate, all the fonts work when launching the app. Restarting the app always fixes it, which, combined with the fact that they get swapped around, leads me to believe that it's some kind of font caching issue.
We use the fonts in code-only (no storyboards or xibs ever). A font would be loaded like this:
let label = UILabel()
label.font = FontHandler.getDefaultFont(size: 15)
The font files ship with the SPM package itself, which contains the FontHandler class used above.
import PackageDescription
let package = Package(
name: "MyPackageName",
defaultLocalization: "en",
platforms: [
.iOS(.v11)
],
products: [
.library(
name: "MyPackageName",
targets: ["MyPackageName"]),
],
targets: [
.target(
name: "MyPackageName",
resources: [
.process("Fonts")
]),
.testTarget(
name: "MyPackageNameTests",
dependencies: ["MyPackageName"]),
]
)
Hello,
I am developing a Mac application via Mac Catalyst and encountering an issue with WKWebView. Specifically, I'm loading a webpage (e.g., https://translate.google.com) in WKWebView, but when I press the copy button on the page, the content doesn't actually copy to the clipboard.
I've attempted modifying the UserAgent without any success. Here is the relevant part of my code:
override func viewDidLoad() {
super.viewDidLoad()
let config = WKWebViewConfiguration()
config.preferences = WKPreferences()
config.defaultWebpagePreferences.preferredContentMode = .desktop
let webView = WKWebView(frame: .zero, configuration: config)
webView.translatesAutoresizingMaskIntoConstraints = false
view.addSubview(webView)
webView.scrollView.showsVerticalScrollIndicator = false
webView.backgroundColor = UIColor.white
webView.scrollView.backgroundColor = UIColor.white
webView.leadingAnchor.constraint(equalTo: view.leadingAnchor).isActive = true
webView.topAnchor.constraint(equalTo: view.topAnchor).isActive = true
webView.trailingAnchor.constraint(equalTo: view.trailingAnchor).isActive = true
webView.bottomAnchor.constraint(equalTo: view.bottomAnchor).isActive = true
if let url = URL(string: "https://translate.google.com") {
let req = URLRequest(url: url)
webView.load(req)
}
}
I'm trying to program an application for learning vocabulary words. I'd like to be able to easily add single words from the Books application using the "Share ..." affordance. However the share extension (and action extension) don't show up in that surface, even with TRUEPREDICATE as the NSExtensionActivationRule.
Facebook shows up as a valid target though, so it seems like there's some way to do it. Is Facebook manually approved by Apple/is there any way that I can make this, even if it's not approvable by the App Store?
Is it possible to determine the location of the pkg file being ran from inside of an InstallerJS block? If so what would the function invocation be?
DateFormatter parses the date correctly when using the default timezone in iPhone settings. However, if I change to any custom TimeZone, DateFormatter returns nil.
Here is the code snippet
extension String{
func toDate() -> Date?{
let dateFormatter = DateFormatter()
dateFormatter.dateFormat = "dd-MMM-yyyy hh:mm a"
let date = dateFormatter.date(from:self)
return date ?? nil
}
}
If I use the default time zone settings in iPhone Settings, it works. However, if I change the time zone to a custom one and switch to a 24-hour format, DateFormatter returns nil.
Sample screenshot attached for the time zone settings.
I have developed an Endpoint Security extension which works with my normal Mac APP.
For now, there are two independent projects, one is ES extension project, and the other is my normal APP. I want to distribute my APP as a pkg, so I need the ES extension in the package.
I wonder to know what is the best way to package the ES extension with my normal APP? Should I add an Endpoint Security target in my normal APP project and copy the codes from ES project? Then, when user launch my APP, at some point, I need register the ES extension by OSSystemExtensionRequest?
Hi, I am fairly new Xcode/Swift and am trying to load a CSV File for use in my development. I have placed the CSV file in my Assets folder but when I try to create my Data Model and load the CSV file. I run into the error: No exact matches in call to initializer. Below is the code. I have attached CSV File. Any help fixing this error would be greatly appreciated. Thanks in advance for your help.
Brian
Hospital_Demographic_Data_Sample.csv
import Foundation
import CSV
struct HospitalData: Codable {
let providerNumber: String
let hospital: String
let address: String
let city: String
let state: String
let zip: String
let wageIndex: Double
let caseMix: Double
let averageCharge: Double
let discharges: Int
let totalCharges: Double
let adjTotalCharges: Double
// Add other fields as needed based on the columns in your CSV file
}
func loadHospitalData() -> [HospitalData]? {
guard let filePath = Bundle.main.path(forResource: "Hospital_Demographic_Data", ofType: "csv") else {
print("File not found")
return nil
}
do {
let csv = try CSV(url: URL(fileURLWithPath: filePath))
var hospitalDataList = [HospitalData]() // Initialize as an empty array
for row in csv.namedRows {
if let providerNumber = String(row["Provider CCN"] ?? ""), // Replace "Provider CCN" with actual column name
let hospital = String(row["Hospital Name"] ?? ""), // Replace with actual column name
let address = String(row["Street Address"] ?? ""),
let city = String(row["City"] ?? ""), // Replace with actual column name
let state = String(row["State Code"] ?? ""), // Replace with actual column name
let zip = String(row["Zip Code"] ?? ""), // Replace with actual column name
let wageIndex = Double(row["Wage Index"] ?? ""),
let caseMix = Double(row["Case Max"] ?? ""),
let averageCharge = Double(row["Base Charge"] ?? ""), // Replace with actual column name
let discharges = Int(row["Medicare Discharges"] ?? ""),
let totalCharges = Double(row["Total Charges"] ?? ""),
let adjTotalCharges = Double(row["Total Wage Normalized Charges"] ?? "") { // Replace with actual column name
let hospitalData = HospitalData(
providerNumber: providerNumber,
hospital: hospital,
address: address,
city: city,
state: state,
zip: zip,
wageIndex: wageIndex,
caseMix: caseMix,
averageCharge: averageCharge,
discharges: discharges,
totalCharges: totalCharges,
adjTotalCharges: adjTotalCharges
)
hospitalDataList.append(hospitalData)
}
}
return hospitalDataList
} catch {
print("Failed to load CSV file: \(error)")
return nil
}
}
// Usage Example
func main() {
if let hospitalData = loadHospitalData() {
for data in hospitalData {
print("Hospital: (data.hospital), City: (data.city), Average Charge: (data.averageCharge)")
}
}
}
Hi,
I'm writing a sandboxed Daemon that I register from my sandboxed application via SMAppService.
The registration is successful, and the daemon is called based on logs.
However when I'm trying to save a keychain item into the keychain, I see entries like this in the logs:
(Security) SecItemAdd
[com.apple.securityd:atomicfile] create /Library/Keychains/System.keychain.sb-1c133873-RPL9wo: Operation not permitted
[com.apple.securityd:security_exception] UNIX error exception: 1
[com.apple.securityd:security_exception] CSSM Exception: 100001 UNIX[Operation not permitted]
[com.apple.securityd:security_exception] CSSM Exception: 100001 UNIX[Operation not permitted]
I'm attempting to create the item with the regular SecItemAdd function call:
var query: [String: Any] = [
kSecClass as String: kSecClassGenericPassword,
kSecAttrLabel as String: "[redacted string]",
kSecAttrAccount as String: "[redacted string]",
kSecAttrService as String: "[redacted string]",
kSecValueData as String: secretData
]
SecItemAdd(query as CFDictionary, nil)
I'm guessing this is because the System keychain is outside of the sandbox for the daemon.
Is there a way to create items for the System Keychain from a sandboxed daemon?
There have been hundreds of the same crashes occurring every day recently.
The crash stack information I have collected is as follows:
AppStoreTools: 15F31e
AppVariant: 1:iPhone15,4:17
Code Type: ARM-64 (Native)
Role: Foreground
Parent Process: launchd [1]
Coalition: com.***.***.xxxx [1125]
Date/Time: 2024-08-12 06:28:47.8121 +0800
Launch Time: 2024-08-12 06:24:53.4931 +0800
OS Version: iPhone OS 18.0 (22A5326f)
Release Type: Beta
Baseband Version: 2.16.02
Report Version: 104
Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Termination Reason: SIGNAL 6 Abort trap: 6
Terminating Process: xxxx [1439]
Triggered by Thread: 0
Last Exception Backtrace:
0 CoreFoundation 0x18f65c08c __exceptionPreprocess + 164 (NSException.m:249)
1 libobjc.A.dylib 0x18c9632e4 objc_exception_throw + 88 (objc-exception.mm:356)
2 Foundation 0x18e2424cc -[NSRLEArray objectAtIndex:effectiveRange:] + 172 (NSAttributedString.m:1408)
3 WebKit 0x1a59d87a0 __70-[WKContentView(WKInteraction) setAttributedMarkedText:selectedRange:]_block_invoke + 156 (WKContentViewInteraction.mm:6305)
4 WebKit 0x1a59d7fec -[WKContentView(WKInteraction) setAttributedMarkedText:selectedRange:] + 136 (WKContentViewInteraction.mm:6297)
5 UIKitCore 0x192db41e0 -[UIResponder(UITextInput_Internal) _setAttributedMarkedText:selectedRange:] + 120 (UITextInput_Internal.m:1735)
6 UIKitCore 0x192a53518 -[UIKBInputDelegateManager setAttributedMarkedText:selectedRange:] + 152 (UIKBInputDelegateManager.m:0)
7 UIKitCore 0x192741050 -[_UIKeyboardStateManager _setAttributedMarkedText:selectedRange:inputString:lastInputString:searchString:compareAttributes:] + 696 (_UIKeyboardStateManager.m:7217)
8 UIKitCore 0x1927407e8 -[_UIKeyboardStateManager setMarkedText:selectedRange:inputString:lastInputString:searchString:candidateOffset:liveConversionSegments:highlighSegmentIndex:] + 692 (_UIKeyboardStateManager.m:7118)
9 UIKitCore 0x192760e38 -[_UIKeyboardStateManager assertIntermediateText:] + 200 (_UIKeyboardStateManager.m:15075)
10 UIKitCore 0x1927440c4 -[_UIKeyboardStateManager syncKeyboardToConfiguration:] + 144 (_UIKeyboardStateManager.m:7934)
11 UIKitCore 0x192745040 __64-[_UIKeyboardStateManager handleKeyboardInput:executionContext:]_block_invoke_2 + 988 (_UIKeyboardStateManager.m:8101)
12 UIKitCore 0x192259834 -[UIKeyboardTaskEntry execute:] + 208 (UIKeyboardTaskQueue.m:869)
13 UIKitCore 0x1922596c8 -[UIKeyboardTaskQueue continueExecutionOnMainThread] + 324 (UIKeyboardTaskQueue.m:447)
14 Foundation 0x18e2b783c __NSThreadPerformPerform + 264 (NSThread.m:1084)
15 CoreFoundation 0x18f62f088 CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION + 28 (CFRunLoop.c:1950)
16 CoreFoundation 0x18f62f01c __CFRunLoopDoSource0 + 176 (CFRunLoop.c:1994)
17 CoreFoundation 0x18f62cb08 __CFRunLoopDoSources0 + 244 (CFRunLoop.c:2031)
18 CoreFoundation 0x18f62bd04 __CFRunLoopRun + 840 (CFRunLoop.c:2949)
19 CoreFoundation 0x18f62b5b8 CFRunLoopRunSpecific + 572 (CFRunLoop.c:3414)
20 GraphicsServices 0x1db3331c4 GSEventRunModal + 164 (GSEvent.c:2196)
21 UIKitCore 0x19218ada0 -[UIApplication _run] + 816 (UIApplication.m:3789)
22 UIKitCore 0x19223917c UIApplicationMain + 340 (UIApplication.m:5439)
23 xxxxx 0x102c1d7b4 main + 84 (main.m:34)
24 dyld 0x1b5120d34 start + 2724 (dyldMain.cpp:1334)
Thread 0 name:
Thread 0 Crashed:
0 libsystem_kernel.dylib 0x00000001df6be254 __pthread_kill + 8 (:-1)
1 libsystem_pthread.dylib 0x0000000216999ef8 pthread_kill + 268 (pthread.c:1721)
2 libsystem_c.dylib 0x0000000197367ad8 abort + 128 (abort.c:122)
3 libc++abi.dylib 0x00000002168bd5b8 abort_message + 132 (abort_message.cpp:78)
4 libc++abi.dylib 0x00000002168abbac demangling_terminate_handler() + 348 (cxa_default_handlers.cpp:77)
5 libobjc.A.dylib 0x000000018c97ee04 _objc_terminate() + 156 (objc-exception.mm:496)
6 qihooloan_ios 0x000000010397a790 CPPExceptionTerminate() + 504
7 libc++abi.dylib 0x00000002168bc87c std::__terminate(void (*)()) + 16 (cxa_handlers.cpp:59)
8 libc++abi.dylib 0x00000002168c00ac __cxa_rethrow + 204 (cxa_exception.cpp:648)
9 libobjc.A.dylib 0x000000018c97a650 objc_exception_rethrow + 44 (objc-exception.mm:399)
10 CoreFoundation 0x000000018f62b67c CFRunLoopRunSpecific + 768 (CFRunLoop.c:3430)
11 GraphicsServices 0x00000001db3331c4 GSEventRunModal + 164 (GSEvent.c:2196)
12 UIKitCore 0x000000019218ada0 -[UIApplication _run] + 816 (UIApplication.m:3789)
13 UIKitCore 0x000000019223917c UIApplicationMain + 340 (UIApplication.m:5439)
14 xxxxx 0x0000000102c1d7b4 main + 84 (main.m:34)
15 dyld 0x00000001b5120d34 start + 2724 (dyldMain.cpp:1334)
After the Screen Time permissions have been provided by the user, when I create a label with the user's selected ApplicationToken or CategoryToken, it's often (not always!) show like this:
I instantiate the label like this, where app is an ApplicationToken or CategoryToken:
Label(app)
.labelStyle(.iconOnly)
After the app is killed and reloaded, the icons show up fine.
Any suggestions on how to fix this? Is this an issue with the Screen Time API, or am I instantiating the label in the wrong way?
Hello, apple!
I get a crash log in development. I check the package contents and find the file does exist in path ''/private/var/containers/Bundle/Application/8BD48BB3-FA58-498B-AE61-559D415D6F18/MyApp.app/Frameworks/MyFramework.framework/MyFramework''
Please help to check if this is our project issue or system issue. The content is:
Incident Identifier: 39F9567A-E204-4FC0-932E-078CB082C9D0
CrashReporter Key: 4fd7a4d1d72f1b6158af9d5d4ff15c85f6adc6f9
Hardware Model: iPhone13,4
Process: WidgetExtension [1259]
Path: /private/var/root/Library/Caches/com.apple.containermanagerd/System/Dead/temp.aEu43U/655B4729-5B26-4E43-A0DF-BAB6E8D03E83/MyApp.app/PlugIns/WidgetExtension.appex/WidgetExtension
Identifier: WidgetExtension
Version: ???
Code Type: ARM-64 (Native)
Role: Unspecified
Parent Process: launchd [1]
Coalition: bundleId [1033]
Date/Time: 2024-08-16 15:48:56.1150 +0800
Launch Time: 2024-08-16 15:48:56.0226 +0800
OS Version: iPhone OS 17.5 (21F5073b)
Release Type: Beta
Baseband Version: 4.50.06
Report Version: 104
Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Termination Reason: DYLD 1 Library missing
Library not loaded: @rpath/MyFramework.framework/MyFramework
Referenced from: <14B7FD51-C300-3B5E-8A13-4C681DE0B359> /Volumes/VOLUME/*/MyApp.app/PlugIns/WidgetExtension.appex/WidgetExtension
Reason: tried: '/usr/lib/swift/MyFramework.framework/MyFramework' (no such file, not in dyld cache), '/private/preboot/Cryptexes/OS/usr/lib/swift/MyFramework.framework/MyFramework' (no such file), '/private/var/containers/Bundle/Application/8BD48BB3-FA58-498B-AE61-559D415D6F18/MyApp.app/PlugIns/WidgetExtension.appex/Frameworks/MyFramework.framework/MyFramework' (no such file), '/private/var/containers/Bundle/Application/8BD48BB3-FA58-498B-AE61-559D415D6F18/MyApp.app/PlugIns/WidgetExtension.appex/Frameworks/MyFramework.framework/MyFramework' (no such file), '/private/var/containers/Bundle/Application/8BD48BB3-FA58-498B-AE61-559D415D6F18/MyApp.app/Frameworks/MyFramework.framework/MyFramework' (no such file), '/usr/lib/swift/MyFramework.framework/MyFramework' (no such file, not in dyld cache),
(terminated at launch; ignore backtrace)
Triggered by Thread: 0
Thread 0 Crashed:
0 dyld 0x1b3d49cd8 __abort_with_payload + 8
1 dyld 0x1b3d55450 abort_with_payload_wrapper_internal + 104
2 dyld 0x1b3d55484 abort_with_payload + 16
3 dyld 0x1b3ce2e00 dyld4::halt(char const*, dyld4::StructuredError const*) + 304
4 dyld 0x1b3cf059c dyld4::prepare(dyld4::APIs&, dyld3::MachOAnalyzer const*) + 4088
5 dyld 0x1b3d14c48 start + 1724
Thread 0 crashed with ARM Thread State (64-bit):
x0: 0x0000000000000006 x1: 0x0000000000000001 x2: 0x000000016bceac50 x3: 0x00000000000000c8
x4: 0x000000016bcea850 x5: 0x0000000000000000 x6: 0x0000000000000000 x7: 0x0000000000000ff0
x8: 0x0000000000000020 x9: 0x000000016bcea7c6 x10: 0x000000000000000a x11: 0x0000000000000000
x12: 0x0000000000000031 x13: 0x1000000000000000 x14: 0x0000000000000004 x15: 0x0000000000008000
x16: 0x0000000000000209 x17: 0x00000001b3ce1884 x18: 0x0000000000000000 x19: 0x0000000000000000
x20: 0x000000016bcea850 x21: 0x00000000000000c8 x22: 0x000000016bceac50 x23: 0x0000000000000001
x24: 0x0000000000000006 x25: 0x000000016bceb720 x26: 0x000000016bceb6c8 x27: 0x000000016bceb660
x28: 0x000000016bceb5d8 fp: 0x000000016bcea820 lr: 0x00000001b3d55450
sp: 0x000000016bcea7e0 pc: 0x00000001b3d49cd8 cpsr: 0x80001000
far: 0x0000000000000000 esr: 0x56000080 Address size fault
Binary Images:
0x104114000 - 0x10411bfff WidgetExtension arm64 <14b7fd51c3003b5e8a134c681de0b359> /private/var/containers/Bundle/Application/8BD48BB3-FA58-498B-AE61-559D415D6F18/MyApp.app/PlugIns/WidgetExtension.appex/WidgetExtension
0x1b3cd8000 - 0x1b3d64ef7 dyld arm64e <da3896ecbf5234efb392a744373c3faa> /usr/lib/dyld
0x0 - 0xffffffffffffffff ??? unknown-arch <00000000000000000000000000000000> ???
Hello, sometimes if I use NSMetadataQuery to obervse my file changes on macOS, it crash for this reason, its odd and i have no clue for this problem becuse in my code I never get results using index, anyone help? thanks!
Application Specific Information:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[_NSMetadataQueryResultArray objectAtIndex:]: index (251625) out of bounds (251625)'
terminating with uncaught exception of type NSException
abort() called
I'm trying to implement push notifications to update Control Center Widget as described here:
https://developer.apple.com/documentation/widgetkit/updating-controls-locally-and-remotely#Use-push-notifications-to-reload-controls
I've made my handler
import WidgetKit
import CommonTools
@available(iOSApplicationExtension 18.0, *)
struct ControlCenterPushHandler: ControlPushHandler {
func pushTokensDidChange(controls: [ControlInfo]) {
print("pushTokensDidChange called. \(controls)")
controls.forEach{
print("ControlInfo \($0)")
}
}
}
And registered it for my controls
var body: some ControlWidgetConfiguration {
AppIntentControlConfiguration(
kind: WidgetConfig.Constants.controlCenterLock,
provider: Provider()) { value in
ControlWidgetToggle(
"Lock/Unlock",
...
}
.pushHandler(ControlCenterPushHandler.self)
}
}
and then run my software on an iPhone 15 pro running iOS 18 developer beta 7.
pushTokensDidChange is not called as I add and remove controls from the control panel. Or ever for that matter.
If I inspect push tokens when my currentValue code runs
struct Provider: AppIntentControlValueProvider {
func currentValue(configuration: ControlCenterButtonConfiguration) async throws -> Value {
let controls = try await ControlCenter.shared.currentControls()
controls.forEach{
print("ControlInfo \($0)")
}
pushInfo is always nil
ControlInfo ControlInfo(kind: "ControlCenterLock", pushInfo: nil, control:...
What steps are needed to get a push token?
now there is a way for apple id to get into the code without a password