Search results for

Swift 6

49,190 results found

Post

Replies

Boosts

Views

Activity

Foundation Models framework dyld symbol errors after macOS 26 Beta 2 - LanguageModelSession constructor missing
Foundation Models framework worked perfectly on macOS 26 Beta 2, but starting from Beta 3 and continuing through Beta 6 (latest), I get dyld symbol errors even with the exact code from Apple's documentation. Environment: macOS 26.0 Beta 6 (25A5351b) Xcode 26 Beta 6 M4 Max MacBook Pro Apple Intelligence enabled and downloaded Error Details: dyld[Process]: Symbol not found: _$s16FoundationModels20LanguageModelSessionC5model10guardrails5tools12instructionsAcA06SystemcD0C_AC10GuardrailsVSayAA4Tool_pGAA12InstructionsVSgtcfC Referenced from: /path/to/app.debug.dylib Expected in: /System/Library/Frameworks/FoundationModels.framework/Versions/A/FoundationModels Code Used (Exact from Documentation): import FoundationModels // This worked on Beta 2, crashes on Beta 3+ let model = SystemLanguageModel.default let session = LanguageModelSession(model: model) let response = try await session.respond(to: Hello) What I've Verified: FoundationModels.framework exists in /System/Library/Frameworks/ Fr
1
0
409
2d
Reply to Screen layout positioning in Swift
something went wrong with formatting the code in your post, so it is a difficult to reproduce. I'm not sure what you're trying to get at here - you can wrap the two check boxes in an HStack, they will then appear side by side HStack { Toggle(isOn: $isCheckedOption900) { Text(9:00am) } .toggleStyle(CheckboxToggleStyle()) Toggle(isOn: $isCheckedOption930) { Text(9:30am) } } Please, when you post code, say for which platform (your code doesn't work on iOS). If you have check boxes for every half hour from 9am till 6:30pm, they're probably not going to fit across one screen anyway, if you don't want a fixed-size window, maybe you want to think about using some other container.
Topic: UI Frameworks SubTopic: SwiftUI
3d
Screen layout positioning in Swift
Hello everyone, I’m just trying to position these times and check boxes side by side as shown in the attachment. So far no matter what I try, it only lists. There are more fixed times for example 10:00am all the way to 6:30pm. The user picks the times that they are NOT available. This is a sample of the code below. The check boxes work fine, it’s just the screen layout I’m having issues with. Any advice will be appreciated. ..................................... import SwiftUI struct ContentView: View { @State private var wakeup = Date.now @State private var isCheckedOption900 = false @State private var isCheckedOption930 = false var body: some View { Text(Select unavailable Dates/Times) DatePicker(Please enter a date, selection: $wakeup) .labelsHidden() } Form{ Section(Enter Blockout times) { Toggle(isOn: $isCheckedOption900) { Text(9:00am) } .toggleStyle(CheckboxToggleStyle()) Toggle(isOn: $isCheckedOption930) { Text(9:30am) } .toggleStyle(CheckboxToggleStyle()) }
Topic: UI Frameworks SubTopic: SwiftUI
1
0
393
3d
Metal 4 & Acceleration Structures
I have really enjoyed looking through the code and videos related to Metal 4. Currently, my interest is to update a ReSTIR Project and take advantage of more robust ways to refit acceleration Structures and more powerful ways to access resources. I am working in Swift and have encountered a couple of puzzles: What is the 'accepted' way to create a MTL4BufferRange to store indices and vertices? How do I properly rewrite Swift code to build and compact an Acceleration Structure? I do realize that this is all in Beta and will happily look through Code Samples this Fall. If other guidance is available earlier, that would be fabulous! Thank you
4
0
491
3d
GKLeaderboard.LoadLeaderboards() return empty when testing on Xcode with local gamekit file (Unity)
var allLeaderboards = await GKLeaderboard.LoadLeaderboards(); Log(allLeaderboards.Count); // returns 0 What am I missing?? What doesn’t work: await GKGameActivityDefinition.LoadGameActivityDefinitions() → count = 0 await GKLeaderboard.LoadLeaderboards() (no args) → 0 leaderboards await GKLeaderboard.LoadLeaderboards(MY ID) → returns 0 GkGameActivity.SetScoreOnLeaderboard(Leaderboard, score, context); returns an error since my Leaderboard is null. Activities and leaderboards are defined in GameCenterResources.gamekit in Xcode. Achievements that I add locally in the .gamekit file do not appear at runtime either; only ASC live ones show. ** What works:** xcode- debug- Gamekit- Manage Game progress- I can submit new scores with the plus button and see the notification on my device. await GKLocalPlayer.Authenticate() succeeds. await GKAchievement.LoadAchievements() returns the list of achievements configured in App Store Connect- but not any new local achievements created in Xcode in GameCenterResources.gamekit En
2
0
657
5d
Seeking clarification on macOS URLs with security scope
I just saw another post regarding bookmarks on iOS where an Apple engineer made the following statement: [quote='855165022, DTS Engineer, /thread/797469?answerId=855165022#855165022'] macOS is better at enforcing the right behavior, so code that works there will generally work on iOS. [/quote] So I went back to my macOS code to double-check. Sure enough, the following statement: let bookmark = try url.bookmarkData(options: .withSecurityScope) fails 100% of the time. I had seen earlier statements from other DTS Engineers recommending that any use of a URL be bracketed by start/stopAccessingSecurityScopedResource. And that makes a lot of sense. If start returns true, then call stop. But if start returns false, then it isn't needed, so don't call stop. No harm, no foul. But what's confusing is this other, directly-related API where a security-scoped bookmark cannot be created under any circumstances because of the URL itself, some specific way the URL was initially created, and/or manipulated? So, what I'm askin
12
0
176
4d
_dispatch_assert_queue_fail under iOS 16.4.1. Don't understand the error.
Since updating to iOS 16.4.1, our app crashes randomly with the following error message. Exception Codes: 0x0000000000000001, 0x0000000199d542c0 Termination Reason: SIGNAL 5 Trace/BPT trap: 5 Terminating Process: exc handler [499] Triggered by Thread: 2 Thread 2 Crashed: 0 libdispatch.dylib 0x199d542c0 _dispatch_assert_queue_fail + 120 1 libdispatch.dylib 0x199d54248 dispatch_assert_queue + 196 2 UIKitCore 0x1949c870c -[UIImageView _mainQ_beginLoadingIfApplicable] + 88 3 UIKitCore 0x19495db34 -[UIImageView setHidden:] + 68 4 UIKitCore 0x19492f128 -[UIButtonLegacyVisualProvider _updateImageView] + 372 5 UIKitCore 0x19492ed78 -[UIButtonLegacyVisualProvider layoutSubviews] + 116 6 UIKitCore 0x19492ecc4 -[UIButton layoutSubviews] + 40 7 UIKitCore 0x1948fbef4 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 1920 8 QuartzCore 0x193db64ac CA::Layer::layout_if_needed(CA::Transaction*) + 500 9 QuartzCore 0x193dc9a28 CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 148 10 QuartzCore 0x193ddae54
6
0
3.2k
May ’23
Validating Mac App Store purchase with StoreKit
For years I've been using Receigen for receipt verification for the Mac App Store build of my application. However, with the deprecation of exit code 173, I am moving to StoreKit-based verification and have a couple of questions. I have followed the instructions from https://developer.apple.com/documentation/storekit/apptransaction/shared and have something like this (simplified): Swift: @objc class ValidateReceipt: NSObject { @objc func validate() async -> Bool { do { let verificationResult = try await AppTransaction.shared switch verificationResult { case .verified(_ /*let appTransaction*/): // StoreKit verified that the user purchased this app and // the properties in the AppTransaction instance return true; default: // The app transaction didn't pass StoreKit's verification return false; } } catch { // Handle errors return false; } } } Objective-C: ValidateReceipt *validateReceipt = [[ValidateReceipt alloc] init]; [validateReceipt validateWithCompletionHandler:^(BOOL result) { if (result) { //
1
0
179
4d
BGTaskScheduler fails to match unique identifiers to a registered wildcard handler for BGContinuedProcessingTask
Testing Environment: iOS Version: 26.0 Beta 7 Xcode Version: 17.0 Beta 6 Device: iPhone 16 Pro Description: We are implementing the new BGContinuedProcessingTask API and are using the wildcard identifier notation as described in the official documentation. Our Info.plist is correctly configured with a permitted identifier pattern, such as com.our-bundle.export.*. We then register a single launch handler for this exact wildcard pattern. We are performing this registration within a UIViewController, which is a supported pattern as BGContinuedProcessingTask is explicitly exempt from the register before applicationDidFinishLaunching requirement, according to the BGTaskScheduler.h header file. The register method correctly returns true, indicating the registration was successful. However, when we then try to submit a task with a unique identifier that matches this pattern (e.g., com.our-bundle.export.UUID), the BGTaskScheduler.shared.submit() call throws an NSInternalInconsistencyException and terminates
1
0
46
4d
header and footer positions shifted in Safari tab settings
Thank you for supporting me. My environment Device: iPhone 15 Pro OS: iOS 26.0 Public Beta (23A5336a) In iOS 26, three types of tabs were added to Safari. Depending on the option, the behavior of the fixed header and footer can be unstable. *Tab settings can be changed in the iOS Settings app under Apps -> Safari > Tabs. The following behavior differs depending on the tab. Compact When scrolling down, the header and footer shift up by a few pixels. A margin is created between the footer and the URL input field. Bottom Behaves the same as Compact. Top The header is completely hidden below the URL input field at the top of the screen, leaving a margin below the footer. Below is the sample code to check the operation. 固定ヘッダー/フッター + モーダル デモページ モーダルを開く スクロール用の適当なコンテンツ1 ヘッダーとフッターは常に表示されます。モーダルボタンを押すと、画面いっぱいのダイアログが開きます。 カード1適当なテキスト。適当なテキスト。適当なテキスト。 カード2適当なテキスト。適当なテキスト。適当なテキスト。 カード3適当なテキスト。適当なテキスト。適当なテキスト。 カード4適当なテキスト。適当なテキスト。適当なテキスト。 カード5適当なテキスト。適当なテキスト。適当なテキスト。 カード6適当なテキスト。適当なテキスト。適当なテ
3
0
673
4d
iOS 26 Beta - AppStore.showManageSubscriptions() Shows Empty View Before StoreKit Sheet
Environment iOS Version: iOS 26 Beta 8 Xcode Version: iOS 26 Beta 6 StoreKit: StoreKit 2 Description When calling AppStore.showManageSubscriptions(in:) on iOS 26 beta, I'm experiencing an unusual presentation behavior that wasn't present in earlier versions. An empty/blank view appears first Then the actual StoreKit manage subscriptions sheet appears on top When dismissing the StoreKit sheet, it closes properly But then I have to dismiss the empty view underneath as well This creates a poor user experience showing double sheets. Code Sample @MainActor func showManageSubscriptions() { guard let scene = UIApplication.shared.connectedScenes .first(where: { $0 is UIWindowScene }) as? UIWindowScene else { return } Task { do { try await AppStore.showManageSubscriptions(in: scene) } catch { // Handle error } } } Expected Behavior The StoreKit manage subscriptions sheet should present directly without any intermediate empty view, as it did in previous iOS versions. Actual Behavior An empty view layer appears
3
0
27
1w
Managing the order of Transparent Proxies from MDM Profile
We have an application which is written in Swift, which activates Transparent Proxy network extension. Our Transparent Proxy module is a system extension, which is exposing an app proxy provider interface (We are using NETransparentProxyProvider class and in extension’s Info.plist we use com.apple.networkextension.app-proxy key.) We are using JAMF MDM profile for installing our transparent proxy in customer environment. We are using VPN payload(https://developer.apple.com/documentation/devicemanagement/vpn) for this network system extension. This payload does not have any field for order. As per https://developer.apple.com/documentation/devicemanagement/vpn/transparentproxy-data.dictionary documentation there is another payload for TransparentProxy and we could create a Transparent Proxy profile using iMazingProfile Editor. Noticed that, if we add the Order attribute to the VPN/TransparentProxy payload, while installing the extension, the save to preferences fails with Error in saving TP configuratio
13
0
169
4d
Using raise in GCD can cause timing issues with the signal mechanism.
when we use raise in GCD, the signal handler is executed asynchronously, whereas in pthread, it is executed synchronously as expected. example: #include <Foundation/Foundation.h> #include <pthread/pthread.h> static void HandleSignal(int sigNum, siginfo_t* signalInfo, void* userContext) { printf(handle signal %dn, sigNum); printf(begin sleepn); sleep(3); printf(end sleepn); } void InstallSignal(void) { static const int g_fatalSignals[] = { SIGABRT, SIGBUS, SIGFPE, SIGILL, SIGPIPE, SIGSEGV, SIGSYS, SIGTRAP, }; int fatalSignalsCount = sizeof(g_fatalSignals) / sizeof(int); struct sigaction action = {{0}}; action.sa_flags = SA_SIGINFO | SA_ONSTACK; #if defined(__LP64__) action.sa_flags |= SA_64REGSET; #endif sigemptyset(&action.sa_mask); action.sa_sigaction = &HandleSignal; struct sigaction pre_sa; for(int i = 0; i < fatalSignalsCount; i++) { int sigResult = sigaction(g_fatalSignals[i], &action, &pre_sa); } } void* RaiseAbort(void *userdata) { raise(SIGABRT); printf(signal handler ha
4
0
155
4d
Reply to Using raise in GCD can cause timing issues with the signal mechanism.
Sorry I didn’t reply sooner. I was notified of your earlier posts )-: [quote='850943022, SilverFruity, /thread/794589?answerId=850943022#850943022, /profile/SilverFruity'] calling raise to throw SIGABRT does not block the thread under GCD. [/quote] By “under GCD” I presume you mean “when using a Dispatch signal event source to handle the signal”. If so, then, yes, that’s expected. Dispatch signal event sources are very much like kqueues, in that they are delivered asynchronously. Thus if you raise a signal by calling raise (or kill with your own pid) then the thread calling raise may well return before the signal is delivered to the queue. If you’re building your own crash reporter — which, as I noted above, is something I specifically discourage — and you choose to implement in-process crash reporting via signals — again, not something I recommend — then you have to use a signal handler rather than a Dispatch signal event source. [quote='851087022, SilverFruity, /thread/794589?answerId=851087022#851087022, /
4d