Posts

Sort by:
Post not yet marked as solved
0 Replies
11 Views
I've encountered a critical issue while testing my app, which is available on the App Store, on the iOS 17.2 beta (iPhone SE simulator). The app freezes and becomes unresponsive. Currently, I haven't found a workaround, which means my app is completely non-functional and untestable on iOS 17.2 beta. The app supports iOS 15.2 and later versions, and it has been working fine from iOS 15.2 through iOS 17.1. The problem only occurs on the iOS 17.2 beta. I have been able to reproduce the issue with the sample code provided below. ■ Test Environment: macOS: 14.0 (23A344) Xcode Version: 15.1 beta (15C5042i) iPhone SE 3rd generation (simulator): iOS 17.2 (21C5029e) ■ Steps to Reproduce: Prerequisites: Prepare an audio file, such as an m4a or mp3, and add it to the Bundle Resources. 1 Launch the sample code provided below. 2 Tap on any row's NavigationLink. After tapping, when the program attempts to access the AVPlayer, the following log is displayed in Xcode: CA_UISoundClient.cpp:1127 Device = 0 HALPlugInManagement.cpp:396 HALPlugInManagement::RegisterPlugIns: loading in-process plug-ins AddInstanceForFactory: No factory registered for id <CFUUID 0x600000285600> F8BB1C28-BAE8-11D6-9C31-00039315CD46 CA_UISoundClient.cpp:1203 renderer = 0x600000011f90, synchronizer: 0x0, repeat: 0, vol: 1.00 3 Tap the Navigation's Back button at the top left. Depending on the timing, there may be no response when pressing the button (screen). Approximately 15 seconds later, the following log is displayed, and the screen becomes responsive again as it returns to the previous view. AQMEIO.cpp:198 timed out after 15.000s (0 0); suspension count=0 (IOSuspensions: ) MEDeviceStreamClient.cpp:467 AQME Default-InputOutput: client stopping after failed start: <CA_UISoundClientBase@0x104015d00>; running count now 0 CA_UISoundClient.cpp:293 CA_UISoundClientBase::StartPlaying: AddRunningClient failed (status = -66681). changing items while animating can result in a corrupted navigation bar 4 If the issue does not reproduce, quit the app and then return to step 1. In the sample code, whether the issue occurs or not may depend on the timing of screen transitions, scrolling, and tapping. (The issue might occur with a high probability if you tap 'back' during a screen transition animation.) On the production app in question, the issue occurs 100% of the time. ■ Sample code import SwiftUI import AVFoundation @main struct iOSAppHangSampleApp: App { @StateObject var model = ContentModel() var body: some Scene { WindowGroup { if #available(iOS 17, *) { NavigationStack { ContentView() .environmentObject(model) } } else { NavigationView { ContentViewIOS15() .environmentObject(model) }.navigationViewStyle(.stack) } } } } @MainActor class ContentModel: ObservableObject { private let player = AVPlayer() @Published var playbackDuration: TimeInterval = .zero func load() { let url = Bundle.main.url(forResource: "YourAudioFilename", withExtension: "m4a")! // Change to your audio. let avassetURL = AVURLAsset(url: url, options: [AVURLAssetPreferPreciseDurationAndTimingKey: true]) let avPlayerItem = AVPlayerItem(asset: avassetURL) self.player.replaceCurrentItem(with: avPlayerItem) self.playbackDuration = avPlayerItem.asset.duration.seconds } } @available(iOS 17, *) struct ContentView: View { @EnvironmentObject private var model: ContentModel private let urls: [URL] = { (0..<50).map { URL(fileURLWithPath: "\($0)")} }() @State private var selected: Int? var body: some View { List(selection: $selected) { ForEach(urls.indices, id: \.self) { idx in let _ = urls[idx] NavigationLink(value: idx) { Text("\(idx)") } } } .navigationDestination(item: $selected) { idx in Content3View() .environmentObject(model) } } } @available(iOS 15, *) struct ContentViewIOS15: View { @EnvironmentObject var model: ContentModel let urls: [URL] = { (0..<50).map { URL(fileURLWithPath: "\($0)")} }() @State var selected: Int? var body: some View { List() { ForEach(urls.indices, id: \.self) { idx in let _ = urls[idx] NavigationLink(tag: idx, selection: $selected) { if selected == idx { Content3View() .environmentObject(model) } } label: { Text("\(idx)") } } } } } struct Content3View: View { @EnvironmentObject private var model: ContentModel var body: some View { Text("duration: \(model.playbackDuration)") .onAppear() { model.load() } } } ■ Investigation The sample code has been tested on the iPhone 17.0 simulator, 15.2 simulator, and an iPhone 17.1 real device, but the issue only appears on the 17.2 beta. Also, when replacing NavigationStack with NavigationView in the sample code, the issue does not seem to occur on iOS 17.2. I'm not sure about the relationship between the back navigation and toolbar inside NavigationStack, but it might be related to the following content in the iOS 17.2 Release Notes. Resolved Issues * Fixed: Resolved a possible Swift access conflict crash that could occur with toolbar items. (113992797) This issue also brings to mind the randomness associated with NavigationView / NavigationStack that I've observed. iOS 16.4 NavigationStack Behavior Unstable https://developer.apple.com/forums/thread/727282 SwiftUI NavigationView pops back when updating observableObject https://developers.apple.com/forums/thread/693137 ■ if anyone has found a workaround, please let me know. I have not been able to confirm whether this issue occurs only on the Simulator, but it is preventing me from continuing to test on iOS 17.2 beta since the app is completely non-functional. If this is an issue with iOS 17.2 beta, I hope for a resolution before the official release of iOS 17.2.
Posted
by
Post not yet marked as solved
0 Replies
13 Views
With iOS 17 creation of HKWorkout is deprecated via its init functions and the recommendation is to use HKWorkoutBuilder. If you try to init HKWorkout like you would pre iOS 17 you get this warning of deprecation: The problem is that I am creating this HKWorkout object inside unit tests in order to test a service that works with such objects. And HKWorkoutBuilder requires a HKHealthStore which itself requires to be authenticated to be able to create HKWorkoutActivity instances, like it would be when an app is running. But since the unit tests cannot accept the request on the HKHealthStore I am not sure if using HKWorkoutBuilder inside unit tests is possible. I've also tried to inherit HKHealthStore and override all of its methods, but still, store requires authorization. Any ideas on how to proceed with creating HKWorkout for unit test purposes?
Posted
by
Post not yet marked as solved
0 Replies
12 Views
Hi, I want to enable swipeActions for some rows of a List while other rows do not have this action. Here is an example: List { ForEach(1..<100) { i in Text("\(i)") .swipeActions(edge: .leading) { Button { total += i } label: { Label("Add \(i)", systemImage: "plus.circle") } .tint(.indigo) } .swipeActions(edge: .trailing) { Button { total -= i } label: { Label("Subtract \(i)", systemImage: "minus.circle") } } } } What would be the best approach to disable the swipeActions for let say the 50 row?
Posted
by
Post not yet marked as solved
0 Replies
12 Views
I'm a newbie in working with SwiftData and I hope for your help in solving the below issue :") It's about deleting the objects into a Model by ModelContext.delete(). It's only possible to delete the data after it has been inserted for about 30 seconds. Just run the source code below, tap on "Add" button to add some samples, and then tap on "Delete" button right away. At this time, Delete action doesn't work. You have to wait about 30 seconds, then tap on "Delete" button, it will work - the sample data are deleted properly. I tested this issue on Xcode 15.1 beta (15C5042i) and found that: This issue always happens on Preview w/ iOS 17 or iOS 17.2. This issue doesn't happen on Simulator w/ iOS 17 BUT it happens on Simulator w/ iOS 17.2 Is this an issue of iOS 17.2 ? Full source code on GitHub Bike.swift import Foundation import SwiftData @Model class Bike { var name: String init(name: String) { self.name = name } } TestApp.swift import SwiftUI import SwiftData @main struct TestApp: App { var body: some Scene { WindowGroup { BikeListView() } .modelContainer(for: Bike.self) } } BikeListView.swift import SwiftUI import SwiftData struct BikeListView: View { @Environment(\.modelContext) var modelContext @Query var bikes: [Bike] var body: some View { VStack { HStack(spacing: 30) { Button { addSamples() } label: { Text("Add") } Button { deleteSamples() } label: { Text("Delete") } } List { ForEach(bikes) { eachBike in Text(eachBike.name) } } } } func addSamples() { let bikeOne = Bike(name: "One") let bikeTwo = Bike(name: "Two") modelContext.insert(bikeOne) modelContext.insert(bikeTwo) } func deleteSamples() { try? modelContext.delete(model: Bike.self) } } #Preview { do { let modelConfig = ModelConfiguration(isStoredInMemoryOnly: false) let modelContainer = try ModelContainer(for: Bike.self, configurations: modelConfig) return BikeListView() .modelContainer(modelContainer) } catch { fatalError("Content View's Preview") } } Thanks for reading and I'm looking forward to your help.
Posted
by
Post not yet marked as solved
1 Replies
23 Views
It looks like [[stitchable]] Metal Core Image kernels fail to get added in the default metal library. Here is my code: class FilterTwo: CIFilter { var inputImage: CIImage? var inputParam: Float = 0.0 static var kernel: CIKernel = { () -> CIKernel in let url = Bundle.main.url(forResource: "default", withExtension: "metallib")! let data = try! Data(contentsOf: url) let kernelNames = CIKernel.kernelNames(fromMetalLibraryData: data) NSLog("Kernels \(kernelNames)") return try! CIKernel(functionName: "secondFilter", fromMetalLibraryData: data) //<-- This fails! }() override var outputImage : CIImage? { guard let inputImage = inputImage else { return nil } return FilterTwo.kernel.apply(extent: inputImage.extent, roiCallback: { (index, rect) in return rect }, arguments: [inputImage]) } } Here is the Metal code: using namespace metal; [[ stitchable ]] half4 secondFilter (coreimage::sampler inputImage, coreimage::destination dest) { float2 srcCoord = inputImage.coord(); half4 color = half4(inputImage.sample(srcCoord)); return color; } And here is the usage: class ViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view. let filter = FilterTwo() filter.inputImage = CIImage(color: CIColor.red) let outputImage = filter.outputImage! NSLog("Output \(outputImage)") } } And the output: StitchableKernelsTesting/FilterTwo.swift:15: Fatal error: 'try!' expression unexpectedly raised an error: Error Domain=CIKernel Code=1 "(null)" UserInfo={CINonLocalizedDescriptionKey=Function does not exist in library data. …•∆} Kernels [] reflect Function 'secondFilter' does not exist.
Posted
by
Post not yet marked as solved
1 Replies
33 Views
I'm a newbie in working with SwiftData and I hope for your help in solving the below issue :") It's about adding new objects into a Model, it takes about 30 seconds to save the data after executing modelContext.insert(). Just run the source code below, tap on "Add" button to add some samples, and then tap on "Delete" button right away. Delete action doesn't work immediately, but it's about 30 seconds after tapping on the "Add" button, it will work - the sample data are deleted properly. I tested and found this issue happens on both Preview and Simulator of: Xcode 15.0 (15A240d) and iOS 17.0 Xcode 15.1 beta (15C5042i) with iOS 17.2 Full source code on GitHub Bike.swift import Foundation import SwiftData @Model class Bike { var name: String init(name: String) { self.name = name } } TestApp.swift import SwiftUI import SwiftData @main struct TestApp: App { var body: some Scene { WindowGroup { BikeListView() } .modelContainer(for: Bike.self) } } BikeListView.swift import SwiftUI import SwiftData struct BikeListView: View { @Environment(\.modelContext) var modelContext @Query var bikes: [Bike] var body: some View { VStack { HStack(spacing: 30) { Button { addSamples() } label: { Text("Add") } Button { deleteSamples() } label: { Text("Delete") } } List { ForEach(bikes) { eachBike in Text(eachBike.name) } } } } func addSamples() { let bikeOne = Bike(name: "One") let bikeTwo = Bike(name: "Two") modelContext.insert(bikeOne) modelContext.insert(bikeTwo) } func deleteSamples() { try? modelContext.delete(model: Bike.self) } } #Preview { do { let modelConfig = ModelConfiguration(isStoredInMemoryOnly: true) let modelContainer = try ModelContainer(for: Bike.self, configurations: modelConfig) return BikeListView() .modelContainer(modelContainer) } catch { fatalError("Content View's Preview") } } Thanks for reading and I'm looking forward to your help.
Posted
by
Post not yet marked as solved
0 Replies
22 Views
I built a web application that is designed to be run from my application bundle by using webView.loadFileURL(htmlFile, allowingReadAccessTo: projectFolder) on a WKWebView. Inside of the site's folder is a directory of svg images (from the ionicons project). At runtime the code tries to load one of those images using: req = fetch(url).then((rsp) => { if (rsp.ok) { return rsp.text().then((svgContent) => { if (svgContent && sanitize !== false) { svgContent = validateContent(svgContent); } (code from the ionicons project). The rsp.ok check simply examines the response to the fetch request to see if the status code is in the range 200-299. For the "file://" URL, however Safari on both MacOS and iOS returns 0 in the status. In spite of that 0, however the request has succeeded and the browser has the content of the file. If I modify the code to ignore rsp.ok the following call accessing rsp.text() succeeds. I'm not sure what the expectations are for a file:// URL passed through fetch. Is the 0 status code a bug in Webkit or Safari, or is it an expected result for a file:// URL and the code making the fetch request needs work?
Posted
by
Post not yet marked as solved
0 Replies
39 Views
Hello, found a issue with tvOS 17. When I use either a frame or padding, the button highlight has no round corners anymore, seems like the left and right margin of buttons is not displayed. Works perfectly fine on tvOS 16. Is this a bug? Any way to fix this? struct ListOfButtons: View { var values = (0...13).map{"item \($0)"} @State var selectedValue: String = "item 0" var body: some View { List(values, id: \.self) { item in Button { selectedValue = item } label: { Text(item) } } .frame(width: 200, height: 900) .padding(40) .background(Color.cyan) } } tvOS 16.4: tvOS 17:
Posted
by
Post not yet marked as solved
0 Replies
34 Views
Hi there, I am quite new to SwiftUI and got this problem: I want to implement TipKit in my app but as soon as I put DisplayFrequency and datastoreLocation into my code, I get this error message: I know that I somehow could look it up in the documentation but unfortunately I am still so new, that I don't understand it. Could someone help? Best Laurin
Posted
by
Post not yet marked as solved
0 Replies
39 Views
I have imported two metal files and defined two stitchable Metal Core Image kernels, one of them being CIColorKernel and other being CIKernel. As outlined in the WWDC video, I need to add a flag -framework CoreImage to other Metal Linker flags. Unfortunately, Xcode 15 puts a double quotes around this and generates an error metal: error: unknown argument: '-framework CoreImage'. So I built without this flag and it works for the first kernel that was added. The other kernel is never added to metal.defaultlib and fails to load. How do I get it working? class SobelEdgeFilterHDR: CIFilter { var inputImage: CIImage? var inputParam: Float = 0.0 static var kernel: CIKernel = { () -> CIKernel in let url = Bundle.main.url(forResource: "default", withExtension: "metallib")! let data = try! Data(contentsOf: url) let kernelNames = CIKernel.kernelNames(fromMetalLibraryData: data) NSLog("Kernels \(kernelNames)") return try! CIKernel(functionName: "sobelEdgeFilterHDR", fromMetalLibraryData: data) }() override var outputImage : CIImage? { guard let inputImage = inputImage else { return nil } return SobelEdgeFilterHDR.kernel.apply(extent: inputImage.extent, roiCallback: { (index, rect) in return rect }, arguments: [inputImage]) } }
Posted
by
Post not yet marked as solved
0 Replies
32 Views
I’m trying to add a window to myMacOS application that will displace html content. I have a .xib with a window with a WKWebView. In my NSWindowController subclass implementation I have an IBOutlet WKWebView *myWebView. The outlet is connected to the WKWebView in the .xib I initialize my subclass of NSWindowController with: self = [super initWithWindowNibName: @“WindowName”]; Then in the windowDidLoad method I initialize the WKWebView with code like this: WKWebViewConfiguration *webConfiguration = [[WKWebViewConfiguration alloc] init]; [webConfiguration defaultWebpagePreferences]; myWebView = [[WKWebView alloc] initWithFrame: [myWebView frame] configuration: webConfiguration]; [webConfiguration release]; //Yes, I know I could use ARC [myWebView setUIDelegate: nil]; This looks fine in the debugger and doesn’t log any errors. Then I can create and load a URLRequest with Apple’s example: NSURL *appleURL = [NSURL URLWithString: @"https://www.apple.com"]; NSURLRequest *myURLRequest = [NSURLRequest requestWithURL: appleURL]; [myWebView loadRequest: myURLRequest]; In order for this to work I have to check the Network Incoming Connections (Server) box in the target’s App Sandbox. (It would be EXTREMELY helpful if this was mentioned in the Developer Documentation) OR I can get file URLs and folders from the Application Bundle and load than with: [myWebView loadFileURL: helpFileURL allowingReadAccessToURL: helpBundleURL]; In order for this to work I have to check the Network Outgoing Connections (Server) box in the target’s App Sandbox. (It would be EXTREMELY helpful if this was mentioned in the Developer Documentation) Then when the window is opened and displayed the WKWebView remains blank. No errors are logged. XCode logs: “WebContent process (0x150001200) took 1.3841 seconds to launch.” so XCode seems to think that the web content was loaded correctly but the WKWebView remains blank. Trying to force it to display with methods like reload and setNeedsDisplay: YES don't fix it. How can I get the WKWebView to actually display the content?
Posted
by
Post not yet marked as solved
0 Replies
25 Views
Some time my force click does not work and then when I disable and enable it then it starts to work help apple help .
Posted
by
Post not yet marked as solved
0 Replies
35 Views
I'm working on dext project (c++), Base SDK and Supported Platforms are set to DriverKit. #include causes errors: error "The iostreams library is not supported since libc++ has been configured without support for localization." error "<locale.h> is not supported since libc++ has been configured without support for localization." Also it's not possible to define custom log object: undeclared identifier 'os_log_create'. <os/log.h> included and os_log function is compiled correct. macOS as additional SDK did not help. Thanks a lot for any hint.
Posted
by
Post not yet marked as solved
0 Replies
30 Views
“I came across the same bug. I think [ isPresented] modifier can not work with [path of NavigationStack] for now. If you want to use path, you have to use navigationDestination(for data, @ViewBuilder destination) to navigate. But Apple did not mention that in their documents. Maybe Apple will solve this problem in future?  No, I updated the question to match my scenario more. The path is empty right now, whereas his path is not. He also does not use the navigationDestination(isPresented, destination) initializer  “
Posted
by
Post not yet marked as solved
1 Replies
43 Views
Hi all, I am trying to persist some data using SwiftData, I have two models: Page Line The models are connected by a relationship like this: import SwiftData @Model final class Page { var id: UUID var created_at: Date var title: String var pinned: Bool @Relationship(deleteRule: .cascade) var lines: [Line] = [] init(id: UUID = UUID(), created_at: Date = .now, title: String = "", pinned: Bool = false) { self.id = id self.created_at = created_at self.title = title self.pinned = pinned self.lines = lines } } import SwiftData @Model final class Line: Identifiable { var id: UUID var input: String var output: String var keyword: Bool @Relationship(inverse: \Page.lines) var page: Page init(id: UUID = UUID(), input: String = "", output: String = "", keyword: Bool = false, page: Page) { self.id = id self.input = input self.output = output self.keyword = keyword self.page = page } } I attached the modelCOntainer to the Window WindowGroup { ContentView() } .modelContainer(for: Page.self) And in my ContentView I am able to query and I get an empty array: @Query(sort: [SortDescriptor(\Page.created_at, order: .reverse)], animation: .spring) var pages: [Page] However, when I try to insert a page or a line my app crashes: func addSample() { let page = Page() context.insert(page) } CrashReporter Key: 8570AF55-7ED0-39AC-F6D4-0322CC485E65 Hardware Model: Mac14,9 Process: Equals [47925] Path: /Users/USER/Library/Developer/Xcode/UserData/Previews/Simulator Devices/2652B05A-811D-4E76-8C11-833748962497/data/Containers/Bundle/Application/23A01A2A-1FB4-4A4F-A542-74637D044F4C/Equals.app/Equals Identifier: com.jonathangiardino.Equals Version: 1.0 (1) Code Type: ARM-64 (Native) Role: Foreground Parent Process: launchd_sim [43814] Coalition: com.apple.CoreSimulator.SimDevice.2652B05A-811D-4E76-8C11-833748962497 [90202] Responsible Process: SimulatorTrampoline [64001] Date/Time: 2023-11-04 17:32:37.5567 +0100 Launch Time: 2023-11-04 17:30:42.6200 +0100 OS Version: macOS 13.5 (22G74) Release Type: User Report Version: 104 Exception Type: EXC_BREAKPOINT (SIGTRAP) Exception Codes: 0x0000000000000001, 0x000000018c985be8 Termination Reason: SIGNAL 5 Trace/BPT trap: 5 Terminating Process: exc handler [47925] Triggered by Thread: 0 Kernel Triage: VM - (arg = 0x0) pmap_enter retried due to resource shortage VM - (arg = 0x0) pmap_enter retried due to resource shortage VM - (arg = 0x0) pmap_enter retried due to resource shortage Thread 0 Crashed:: Dispatch queue: com.apple.main-thread 0 libswiftCore.dylib 0x18c985be8 _assertionFailure(_:_:file:line:flags:) + 248 1 SwiftData 0x1a89d5724 specialized static ModelContainer.currentContainer(_:) + 692 2 SwiftData 0x1a8a4f5d0 _DefaultBackingData.init(for:) + 248 3 SwiftData 0x1a8a5419c _DefaultBackingData.__allocating_init(for:) + 52 4 SwiftData 0x1a8a11438 static PersistentModel.createBackingData<A>() + 72 5 Equals 0x1023a6e84 Page.init(id:created_at:title:pinned:) + 488 (@__swiftmacro_6Equals4Page5ModelfMm_.swift:2) 6 Equals 0x1023a6c8c Page.__allocating_init(id:created_at:title:pinned:) + 92 7 ContentView.1.preview-thunk.dylib 0x10d21181c ContentView.__preview__addSampleLine() + 256 (ContentView.swift:350) 8 ContentView.1.preview-thunk.dylib 0x10d214b6c ContentView.__preview__addNewLine() + 96 (ContentView.swift:246) 9 ContentView.1.preview-thunk.dylib 0x10d21a5b8 closure #3 in closure #1 in closure #1 in ContentView.__preview__body.getter + 36 (ContentView.swift:111) Can anyone give me a hnt of what I am doing wrong???
Posted
by
Post not yet marked as solved
0 Replies
35 Views
I'm trying to make a PHP implementation to fetch data from the WeatherKit REST API. When using jwt.io to create a JWT, everything works correctly, so my keys, identifiers, etc. are set up correctly. When using jtw.io to verify my own generated JWT, the header and payload are correct, but "Invalid Signature" is displayed. The file path for the private key exists and the file is loaded correctly. My PHP code: function generate_jwt(): String { $tmpFilePath = realpath(dirname(__FILE__)).'/'; $filePath = $tmpFilePath.'../AuthKey.pem'; //$filePath = $tmpFilePath.'../AuthKey.p8'; $private_key = NULL; if (file_exists($filePath)) { $private_key = file_get_contents($filePath); } $header = [ "alg" => "ES256", "kid" => "XXXXXXXXXX", "id" => "YYYYYYYYYY.com.thing.stuff", "typ" => "JWT" ]; $header = $this->base64_url_encode(json_encode($header)); $issuedAt = time(); $payload = [ "iat" => $issuedAt, "exp" => $issuedAt + 30, "iss" => "YYYYYYYYYY", "sub" => "com.thing.stuff" ]; $payload = $this->base64_url_encode(json_encode($payload)); $signature = $this->base64_url_encode(hash_hmac('sha256', "$header.$payload", $private_key, true)); $jwt = "$header.$payload.$signature"; return $jwt; } function base64_url_encode($text): String { return str_replace(['+', '/', '='], ['-', '_', ''], base64_encode($text)); } Any ideas?
Posted
by
Post not yet marked as solved
0 Replies
32 Views
I do NOT have an iPhone or iPad and I need to create a provisioning profile to configure the signing in my Xcode project. I have tried "iOS App Development" profile, but it required adding an iPhone. I have later tried creating an "Developer ID" provisioning profile, which redirects to creating a certificate, choosing "Apple Development" certificate created with an CRS from my Mac. However, this certificate cannot be used to then create the corresponding profile as I was expecting. I trying to create a Provisioning Profile to manually import it into Xcode instead on the automatically managed signing option, since it is not working.
Posted
by

TestFlight Public Links

Get Started

Pinned Posts

Categories

See all