iOS is the operating system for iPhone.

Posts under iOS tag

200 Posts
Sort by:

Post

Replies

Boosts

Views

Activity

Rosetta Destinations not showing Xcode 16
In Xcode 16 Rosetta option is not available, Actually I'm facing some architectural issue in non rosetta simulators. The code will run only Rosetta simulators. could not find module 'module name' for target 'x86_64-apple-ios-simulator' In Xcode 15 it's available under Product -> Destination ->Destination Architecture. enter image description here
2
0
89
4d
iOS18Bate导航栏
代码如下 (void)viewDidLoad { [super viewDidLoad]; self.navigationController.navigationBar.translucent = NO; } (void)viewWillAppear:(BOOL)animated { [super viewWillAppear:animated]; [self.navigationController setNavigationBarHidden:true]; } 此时加载VC时顶部会出现空白,整个VC的frame的Y值向下偏移了状态栏的高度,再次切换到此VC则会恢复,这是iOS18Bate的bug吗
0
0
69
4d
iCloud Synchronization doesn’t work
I’m trying to sync data from the AppData on one device to another device with the same iCloud. It uploads the data to the CloudKit but it doesn’t write the data it fetches from the cloud into the AppData storage. It should store a timestamp, a few integers, and two lists of integers. The lists are both optional and store numbers. They can have 0 up to 50 numbers in them. This is the part where it should fetch the records and store them in the AppData let container = CKContainer(identifier: "iCloud.com.calchunt") let privateDatabase = container.privateCloudDatabase let dispatchGroup = DispatchGroup() var errors: [Error] = [] // Leere Liste zum Speichern neuer Spielsitzungen aus der Cloud var newGameSessions: [AppModule.GameSession] = [] for gameSession in gameSessions { let recordIDString = gameSession.id.uuidString // UUID zu String umwandeln let recordID = CKRecord.ID(recordName: recordIDString) dispatchGroup.enter() privateDatabase.fetch(withRecordID: recordID) { (existingRecord, error) in defer { dispatchGroup.leave() } if let error = error { // Fehler beim Abrufen des Records print("Fehler beim Abrufen des Records aus CloudKit: \(error.localizedDescription)") errors.append(error) } else if let existingRecord = existingRecord { // Record existiert in der Cloud print("Record mit ID \(existingRecord.recordID.recordName) existiert in CloudKit") // à berprüfen, ob der Record bereits im AppModule vorhanden ist if let _ = gameSessions.firstIndex(where: { $0.id == gameSession.id }) { // Record existiert bereits im AppModule, überspringe das Speichern print("Record mit ID \(existingRecord.recordID.recordName) existiert bereits im AppModule, überspringe das Speichern") } else { // Record existiert nicht im AppModule, füge ihn zur Liste der neuen Spielsitzungen hinzu let newGameSession = AppModule.GameSession( id: gameSession.id, losungszahl: gameSession.losungszahl, elapsedTime: gameSession.elapsedTime, currentDate: gameSession.currentDate, skipped: gameSession.skipped, skipped2: gameSession.skipped2, level: gameSession.level ) newGameSessions.append(newGameSession) print("Record mit ID \(existingRecord.recordID.recordName) wird zum AppModule hinzugefügt") } } else { // Record existiert nicht in der Cloud print("Record mit ID \(recordID.recordName) existiert nicht in CloudKit") } } } dispatchGroup.notify(queue: .main) { if !errors.isEmpty { for error in errors { print("Fehler beim Abrufen der Daten aus CloudKit: \(error.localizedDescription)") } } else { // Füge neue Spielsitzungen zum AppModule hinzu gameSessions.append(contentsOf: newGameSessions) // Speichere die aktualisierten Daten im AppStorage do { let encoder = JSONEncoder() let gameSessionsData = try encoder.encode(gameSessions) GameSessions = gameSessionsData print("Daten erfolgreich aus CloudKit geladen und im AppStorage gespeichert") } catch { print("Fehler beim Codieren und Speichern der Daten im AppStorage: \(error.localizedDescription)") } } } }
1
0
73
4d
self.edgesForExtendedLayout=UIRectEdgeNone ios18beta move UIView down
Using the UINavigationController, jump from page A(UIViewController A) to page B (UIViewController B), and page B(UIViewController B) clicks back. When page A(UIViewController A) is returned, the view of page A(UIViewController A) moves down as a whole, and the top turns black. Reproduce steps: step1: Set “self.edgesForExtendedLayout = UIRectEdgeNone;” in the method “viewDidLoad” UIViewController - (void)viewDidLoad { [super viewDidLoad]; // step1 self.edgesForExtendedLayout = UIRectEdgeNone; } step2:Set “ self.navigationController.navigationBarHidden = YES;” in the method “viewWillAppear” UIViewController - (void)viewWillAppear:(BOOL)animated { [super viewWillAppear:animated]; // step2 self.navigationController.navigationBarHidden = YES; } step3:Set “self.navigationController.navigationBarHidden = NO;” in the method “viewWillDisappear” UIViewController - (void)viewWillDisappear:(BOOL)animated { [super viewWillDisappear:animated]; // step3 self.navigationController.navigationBarHidden = NO; } step4:Set “[self.navigationControllerpopViewControllerAnimated:NO];” in the method “viewWillDisappear” UIViewController When page is returned - (void)click { UIViewController *vc = [[UIViewController alloc] init]; vc.view.backgroundColor = [UIColor redColor]; [self.navigationController pushViewController:vc animated:YES]; dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ // step4,animated NO [self.navigationController popViewControllerAnimated:NO]; }); } The test found that the UIView was normal after removing the "self.edgesForExtendedLayout=UIRectEdgeNone" setting.
0
0
73
5d
Cannot build IPA file from Gitlab-CI
I already posted in StackOverflow but I got no answer. So I'm gonna try here. I'm using Flutter and I've been trying to build .ipa through Gitlab CI and GitLab Runner that will be running on my MacOS machine. But I hit a dead end with this error Error (Xcode): Building for 'iOS', but linking in dylib (/Library/Developer/CommandLineTools/SDKs/MacOSX14.0.sdk/usr/lib/libobjc.A.tbd) built for 'macOS macCatalyst zippered(macOS/Catalyst)' Error (Xcode): Linker command failed with exit code 1 (use -v to see invocation) Encountered error while archiving for device. This error unfortunately cannot be reproduced locally, when I ran this code. The build will be successful and produced IPA file normally. flutter build ipa --release --obfuscate --split-debug-info=build/ios/ipa/debug_symbols --build-number=${CI_JOB_ID:0:8} --export-options-plist ./ios/export.plist which make it incredibly difficult to debug. I tried searching Google and all it shown are result of people trying to build iOS simulator. Their solution was excluding architecture arm64 which obviously wouldn't work in this case. And I already excluding i386 and armv7 architecture. and somehow my Gitlab CI still tried to build with MacOS library instead. I'm not sure if this is one of the causes. But I noticed that every time my GitLab Runner CI reach a new stage. This command is automatically declared : declare -x SDKROOT="/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk" Maybe it's related? I honestly don't know what to do now.
1
0
45
3d
VoiceOver Headings Accessibility Rotor with SwiftUI
Hi, I'd like to mark views that are inside a LazyVStack as headers for VoiceOver (make them appear in the headings rotor). In a VStack, you just have add .accessibilityAddTraits(.isHeader) to your header view. However, if your view is in a LazyVStack, that won't work if the view is not visible. As its name implies, LazyVStack is lazy so that makes sense. There is very little information online about system rotors, but it seems you are supposed to use .accessibilityRotor() with the headings system rotor (.accessibilityRotor(.headings)) outside of the LazyVStack. Something like the following. .accessibilityRotor(.headings) { ForEach(entries) { entry in // entry.id must be the same as the id of the SwiftUI view it is about AccessibilityRotorEntry(entry.name, id: entry.id) } } It kinds of work, but only kind of. When using .accessibilityAddTraits(.isHeader) in a VStack, the view is in the headings rotor as soon as you change screen. However, when using .accessibilityRotor(.headings), the headers (headings?) are not in the headings rotor at the time the screen appears. You have to move the accessibility focus inside the screen before your headers show up. I'm a beginner in regards to VoiceOver, so I don't know how a blind user used to VoiceOver would perceive this, but it feels to me that having to move the focus before the headers are in the headings rotor would mean some users would miss them. So my question is: is there a way to have headers inside a LazyVStack (and are not necessarily visible at first) to be in the headings rotor as soon as the screen appears? (be it using .accessibilityRotor(.headings) or anything else) The "SwiftUI Accessibility: Beyond the basics" talk from WWDC 2021 mentions custom rotors, not system rotors, but that should be close enough. It mentions that for accessibilityRotor to work properly it has to be applied on an accessibility container, so just in case I tried to move my .accessibilityRotor(.headings) to multiple places, with and without the accessibilityElement(children: .contain) modifier, but that did not seem to change the behavior (and I could not understand why accessibilityRotor could not automatically make the view it is applied on an accessibility container if needed). Also, a related question: when using .accessibilityRotor(.headings) on a screen, is it fine to mix uses of .accessibilityRotor(.headings) and .accessibilityRotor(.headings)? In a screen with multiple type of contents (something like ScrollView { VStack { MyHeader(); LazyVStack { /* some content */ }; LazyVStack { /* something else */ } } }), having to declare all headers in one place would make code reusability harder. Thanks
1
0
134
5d
Screen Time Bug: iOS 18
Hey, So I obviously downloaded the dev beta the second I could, and I didn’t notice any bugs. Except after the first reboot, the new Screen Time settings UI is replaced by the old one (see video below). This also has an effect on Remote Screen Time Management somehow, making any change (Downtime, App limit, etc) from the guardian’s device over the internet (as in not directly on the managed phone) not take effect at all. Rebooting does nothing, connecting to wifi does nothing, everything. I reported this to the Feedback Assistant so hopefully they catch wind of this soon. Anyone else experiencing this bug or does anyone have a workaround? Reply if so. Thanks, Mr. Sharky
2
3
210
3d
TestFlight not working with In-app purchases
Environment react-native-iap: 12.12.2. react-native: 0.72.12. Platforms (physical & simulator): iPhone 11 - OS version 17.4 /// iOS Simulator iPhone 15 Pro Max - OS version 17.4 Description Hello, I am trying to test the purchase of a subscription and an in-app product within my react native app. I have setup the necessary Sandbox account in App Store Connect, created a Store kit file in Xcode that I also synced with the products I created in the App Store Connect dashboard. If I use Xcode to run the app on a physical device (after logging into the sandbox account), I am able to purchase a subscription/in-app product without any issues. If I purchased a subscription on the physical phone I can go into Settings > App Store > Sandbox Account Management and see the purchased subscription, change renewal rate, clear purchase history etc.. If I use the TestFlight build with a physical phone (logging in with the sandbox account) the in app purchases stop working correctly. After purchasing a subscription it is not shown in the Sandbox Account Management, so I am unable to cancel it. Upon trying to purchase another subscription the apple service keeps returning the same exact subscription that I "originally" purchased. How am I supposed to cancel that subscription if it not shown in the sandbox account subscription list? Adding a different sandbox account does not help either, trying to purchase another subscription returns the same subscription that I am unable to cancel. Is there a step in the TestFlight environment that I am missing on setup? Expected Behavior Upon purchasing a subscription in the TestFlight environment on a physical device I should be able to cancel that subscription. Here's an example of what function I am calling on purchasing a subscription: const product = { productId: 'example_monthly_subscription' }; subscribe(product.productId); Any help would be appreciated.
0
0
99
5d
SIGABRT Signal 6 Abort trap
I got crash report for my mobile application private var _timedEvents: SynchronizedBarrier<[String: TimeInterval]> private var timedEvents: [String: TimeInterval] { get { _timedEvents.value } set { _timedEvents.value { $0 = newValue } } } func time(event: String) { let startTime = Date.now.timeIntervalSince1970 trackingQueue.async { [weak self, startTime, event] in guard let self else { return } var timedEvents = self.timedEvents timedEvents[event] = startTime self.timedEvents = timedEvents } } From the report, the crash is happening at _timedEvents.value { $0 = newValue } struct ReadWriteLock { private let concurentQueue: DispatchQueue init(label: String, qos: DispatchQoS = .utility) { let queue = DispatchQueue(label: label, qos: qos, attributes: .concurrent) self.init(queue: queue) } init(queue: DispatchQueue) { self.concurentQueue = queue } func read<T>(closure: () -> T) -> T { concurentQueue.sync { closure() } } func write<T>(closure: () throws -> T) rethrows -> T { try concurentQueue.sync(flags: .barrier) { try closure() } } } struct SynchronizedBarrier<Value> { private let lock: ReadWriteLock private var _value: Value init(_ value: Value, lock: ReadWriteLock = ReadWriteLock(queue: DispatchQueue(label: "com.example.SynchronizedBarrier", attributes: .concurrent))) { self.lock = lock self._value = value } var value: Value { lock.read { _value } } mutating func value<T>(execute task: (inout Value) throws -> T) rethrows -> T { try lock.write { try task(&_value) } } } What could be the reason for the crash? I have attached the crash report. Masked.crash
4
0
131
4d
The DateFormatter is returning wrong date format 2024-04-23T7:52:49.352 AMZ, 2024-05-23T11:16:24.706 a.m.Z
import Foundation let formatter = DateFormatter() let displayLocalFormat = true or false let timeZone = UTC let dateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'" let currentDate = Date() formatter.locale = displayLocalFormat ? Locale.current : Locale(identifier: "en_US_POSIX") formatter.dateFormat = dateFormat formatter.timeZone = timeZone formatter.string(from: date) // This function returns date format 2024-05-23T11:16:24.706 a.m.Z
6
0
179
1d
Background Health Store Access for Lock Screen Widgets
It's fairly well know and stated that the Apple Health / HealthKit data store is unavailable when iPhone is locked. Since Lock Screen Widgets were introduced there's been a feature parity mismatch with Apple's own Fitness app which is able to display updating Activity Rings on the Lock Screen. Third party apps cannot do this and have to rely unlocking their device to then trigger an update. This means they often display stale and wrong Health data. With the release of iOS 18 beta, I see no changes to this... Is there anything I've missed? Currently for requesting the Timeline Updates on my Widget I have to just keep requesting updates as often as possible and hope that each time the iPhone might be unlocked.... This is inefficient and a waste of device resources. Even a Widget timeline reload API that let the developer say "Only call update if iPhone unlocked" would be useful.
2
0
109
5d
SwiftData ModelContext Fetch Crashing
I'm currently using Xcode 16 Beta (16A5171c) and I'm getting a crash whenever I attempt to fetch using my ModelContext in my SwiftUI video using the environment I'm getting a crash specifically on iOS 18 simulators. I've opened up a feedback FB13831520 but it's worth noting that I can run the code I'll explain in detail below on iOS 17+ simulator and devices just fine. I'm getting the following crash: *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'The specified URI is not a valid Core Data URI: x-coredata:///MyApp/XXXXX-XXXXX-XXXX-XXXX-XXXXXXXXXXXX' It's almost as if on iOS18 SwiftData is unable to find the file on the simulator to perform CRUD operations. All I'm doing in my project is simply fetching data using the modelContext. func contains(_ model: MyModel, in context: ModelContext) -> Bool { let objId = palette.persistentModelID let fetchDesc = FetchDescriptor<MyModel>(predicate: #Predicate { $0.persistentModelID == objId }) let itemCount = try? context.fetchCount(fetchDesc) return itemCount != 0 }
3
2
172
5d
Get time it took to complete HMCharacteristic.writeValue()
I'm working on an app that uses HomeKit-enabled accessories such as wall plugs to control a photographic enlarger in a darkroom. This requires precise timing when toggling the power state of the plug. For example, the timer in my app might be set to 5 seconds, so I turn on the plug using writeValue() on the plugs power state characteristic, wait 5 seconds, then turn it off again. I want to be able to measure if the plug actually responded to the command and if there was any delay in the plug actually turning on/off so I can display a warning to the user if network latency resulted in the plug being on for longer than the set time. Does writeValue() (in my case, the async/await version) only return when the plug has been turned on, or does it return as soon as the command has been sent, regardless of if it has been received/acted on? Is there a way I can (a) quickly verify that the plug has been turned on/off, and (b) measure how long it took for the plug to act on the request, that is, the time elapsed between when writeValue() is called and when the plug actually updates to the corresponding value?
0
0
96
6d
Mimic TV App back button in UIKit
Hi In my application I'm trying to recreate the behaviour of the back button in the Apple TV app on iOS. What I'm looking for is a way to have a material background but also making it possible to animate (with an interruptible animation) the transition when the user scrolls down in a scroll view. When searching around there seems to be 2 hacks which doesn't solve my problem. Either you add a static image for the back button, which doesn't solve any of the points I mentioned before. The other hack is to stop using the back button in the UINavigationBar and start leveraging the left button instead, which I don't want because you loose the swipe back gesture. Can you just pinpoint me what API I could use to get a similar look and feel?
0
0
92
6d
Why is `isDepthDataDeliverySupported` returning false on an iPad Pro using `builtInDualWideCamera`?
I am trying to use the AVCamFilter Apple sample project discussed in this WWDC session to get depth data using the dual camera. The project has built-in features to get depth data from the dual camera. When the sample project was written builtInDualWideCamera didn't exist yet, and the project only tries to get builtInDualCamera and builtInWideAngleCamera. When I run the project on my iPad Pro it doesn't show any of the depth-related UI because the device doesn't have a builtInDualCamera device. So I added builtInDualWideCamera in to the videoDeviceDiscoverySession, and it seems to get that device properly, but isDepthDataDeliverySupported is returning false still. Is there some reason why isDepthDataDeliverySupported is false even though I seem to be using a dual camera device? I know the device has a builtInLiDARDepthCamera but I wanted to try out the dual camera depth data to see how it performs for shorter distances. I wouldn't have expected the dual camera depth data delivery to be made unavailable on the device just because the LiDAR sensor is already available. Using iPadOS 17.5.1, iPad Pro 11-inch 4th generation. The depth feature of this sample app works fine on an iPhone 15 I tested. Also tried on an iPhone 15 Pro and it worked even though that device also has a LiDAR sensor, so the issue is presumably not related to the fact that the iPad Pro has a LiDAR sensor.
4
0
185
6d
RealityKit on iOS: New anchor entity takes ages to show up
I'm implementing an AR app with Image Tracking capabilities. I noticed that it takes very long for the entities I want to overlay on a detected image to show up in the video feed. When debugging using debugOptions.insert(.showAnchorOrigins), I realized that the image is actually detected very quickly, the anchor origins show up almost immediately. And I can also see that my code reacts with adding new anchors for my ModelEntities there. However, it takes ages for these ModelEntities to actually show up. Only if I move the camera a lot, they will appear after a while. What might be the reason for this behaviour? I also noticed that for the first image target, a huge amount of anchors are being created. They start from the image and go all up towards the user. This does not happen with subsequent (other) image targets.
1
0
117
3d
Beta Problems
Hello Apple official engineer? I am a User of iOS 18 Beta & MacOS Sequoia Beta. I found some errors and uncomfortable problems of the Operating systems, so I want to notice them to you. The iOS 18 the tabs of Control center. I want to delete empty of one, but the is no way to delete. There was no control component. How should I do? -_- text of item that modified its size in the control panel protruded out of the container. the rounder container can't contain the text. The text should be more smaller or container should be changed. the responses when I touch has delay. Our family all use iPhone 12Pro or 13, when iOS 17 came out and I installed it, our phones became slower. If iOS 18 (official) assigns more processors, I think only iPhone 15 and 16 don't have lags. Also, There are some thing problem in the MacOS Sequoia(15) it doesn't support Xcode 15(.4). I should download 16 Beta!!! it has so many lag more than iOS 18. The Mac's benefit was soft screen but it become very hard moving ^^(??) this is not sure... after I update MacOS 15, the macbook makes "zzzzzzziiiii" sound when I charge. the beta does not 100% localized. I'm Korean but many messages and systems sometimes show the english. Pls check this contents!
1
0
329
6d