iOS is the operating system for iPhone.

iOS Documentation

Posts under iOS tag

2,764 Posts
Sort by:
Post not yet marked as solved
1 Replies
73 Views
Hi everyone, I'm working on an iOS app where I need to implement content filtering functionality. I've successfully implemented a network extension target in my iOS app to filter data locally. However, I'm now aiming to extend this functionality to filter content over HTTPS. Currently, I'm utilizing a local data source for filtering, but I want to explore options for filtering content directly over HTTPS connections, like this URL: https://dns.nextdns.io/46d65d. I've reviewed the available Apple APIs and documentation but haven't found a straightforward solution for HTTPS content filtering. Can anyone provide guidance or suggest any relevant resources for implementing HTTPS content filtering within a network extension target on iOS? Any help or insights would be greatly appreciated! Thank you in advance!
Posted Last updated
.
Post not yet marked as solved
0 Replies
38 Views
I want to change the display language, particularly for week and the year and date on MultiDatePicker. By adjusting the locale, the year and date can be changed. However, I'm unable to change the display for week . I've tried several methods, such as setting the calendar and adjusting the time zone, but none of them seem to work. Are there any good way to solve it?
Posted
by hcrane.
Last updated
.
Post not yet marked as solved
0 Replies
50 Views
Hello, I'll be objective: when I compile any APP in my XCode and transfer the APP to my iPhone, including the test APP "Hello world!", whether via network or USB cable, when I open the APP it simply doesn't work and the iPhone crashes. Only that. My XCode is 15.3, iPhone 14 Pro Max, IOS 17.5, macOS latest version.
Posted Last updated
.
Post not yet marked as solved
0 Replies
65 Views
I created a PWA that requires access to users' geolocation to perform a certain action in the system. The correct operation would be the user opens the application, and then the operating system prompts them to allow sharing their exact location with the PWA. However, this is not happening with a few users who have iPhone 11 or XR. I tested it on iPhones 14, 13, 11 Pro, and even iPhone 6, and it works as expected. I directly spoke with a user who was experiencing the problem and conducted some tests. I checked if location access was allowed in the settings. I verified if Safari was accepting with the option to always ask selected. In the settings of my system's website, I checked if location access was allowed with the option to always ask chosen. We changed all prompting options to allow. We opened the following site https://whatpwacando.today/ and found that geolocation was also not possible. Everything indicates that the issue lies with these users' phones; however, other geolocation methods work fine, as other geolocation apps function properly. This leads me to think that it might be a problem with Safari not working properly with the HTML Geolocation API. I'm not sure if there are any more advanced settings that could help or if anyone else has encountered this issue.
Posted
by dariel26.
Last updated
.
Post not yet marked as solved
0 Replies
99 Views
I added debug break point to the first line of MyDeviceActivityMonitor.swift, it never got trigger. I am able to launch the app, select discouraged and encouraged app. discouraged apps are getting restricted which is expected. but device activity extension is never called. I have all the permission and certificate. I created an app group. import SwiftUI import FamilyControls import ManagedSettings @main struct GetALifeApp: App { @UIApplicationDelegateAdaptor(AppDelegate.self) private var appDelegate @StateObject var model = MyModel.shared @StateObject var store = ManagedSettingsStore() var body: some Scene { WindowGroup { ContentView() .environmentObject(model) .environmentObject(store) } } } class AppDelegate: NSObject, UIApplicationDelegate { func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil) -> Bool { initiateAsyncSetup() MySchedule.setSchedule() return true } private func initiateAsyncSetup() { Task { do { try await AuthorizationCenter.shared.requestAuthorization(for: .individual) } catch { print("Error during asynchronous setup: \(error)") } } } } import Foundation import FamilyControls import ManagedSettings private let _MyModel = MyModel() class MyModel: ObservableObject { let store = ManagedSettingsStore() @Published var selectionToDiscourage: FamilyActivitySelection @Published var selectionToEncourage: FamilyActivitySelection init() { selectionToDiscourage = FamilyActivitySelection() selectionToEncourage = FamilyActivitySelection() } class var shared: MyModel { return _MyModel } func setShieldRestrictions() { let applications = MyModel.shared.selectionToDiscourage store.shield.applications = applications.applicationTokens.isEmpty ? nil : applications.applicationTokens store.shield.applicationCategories = applications.categoryTokens.isEmpty ? nil : ShieldSettings.ActivityCategoryPolicy.specific(applications.categoryTokens) } } import Foundation import DeviceActivity extension DeviceActivityName { static let daily = Self("daily") } extension DeviceActivityEvent.Name { static let encouraged = Self("encouraged") } let schedule = DeviceActivitySchedule( intervalStart: DateComponents(hour: 0, minute: 0), intervalEnd: DateComponents(hour: 23, minute: 59), repeats: true ) class MySchedule { static public func setSchedule() { print("Setting schedule...") print("Hour is: ", Calendar.current.dateComponents([.hour, .minute], from: Date()).hour!) let events: [DeviceActivityEvent.Name: DeviceActivityEvent] = [ .encouraged: DeviceActivityEvent( applications: MyModel.shared.selectionToEncourage.applicationTokens, threshold: DateComponents(second: 2) ) ] let center = DeviceActivityCenter() do { print("Try to start monitoring...") print(events) try center.startMonitoring(.daily, during: schedule, events: events) } catch { print("Error monitoring schedule: ", error) } } } import SwiftUI struct ContentView: View { @State private var isDiscouragedPresented = false @State private var isEncouragedPresented = false @EnvironmentObject var model: MyModel var body: some View { VStack { Button("Select Apps to Discourage") { isDiscouragedPresented = true } .familyActivityPicker(isPresented: $isDiscouragedPresented, selection: $model.selectionToDiscourage) Button("Select Apps to Encourage") { isEncouragedPresented = true } .familyActivityPicker(isPresented: $isEncouragedPresented, selection: $model.selectionToEncourage) } .onChange(of: model.selectionToDiscourage) { MyModel.shared.setShieldRestrictions() } .onChange(of: model.selectionToEncourage) { MySchedule.setSchedule() } } } struct ContentView_Previews: PreviewProvider { static var previews: some View { ContentView() .environmentObject(MyModel()) } } import Foundation import DeviceActivity import ManagedSettings class MyDeviceActivityMonitor: DeviceActivityMonitor { let store = ManagedSettingsStore() override func intervalDidStart(for activity: DeviceActivityName) { print("intervalDidStart") super.intervalDidStart(for: activity) store.shield.applications = nil print("intervalDidStart") } override func intervalDidEnd(for activity: DeviceActivityName) { super.intervalDidEnd(for: activity) } override func eventDidReachThreshold(_ event: DeviceActivityEvent.Name, activity: DeviceActivityName) { super.eventDidReachThreshold(event, activity: activity) print("used encouraged") store.shield.applications = nil } override func intervalWillStartWarning(for activity: DeviceActivityName) { super.intervalWillStartWarning(for: activity) // Handle the warning before the interval starts. } override func intervalWillEndWarning(for activity: DeviceActivityName) { super.intervalWillEndWarning(for: activity) // Handle the warning before the interval ends. } override func eventWillReachThresholdWarning(_ event: DeviceActivityEvent.Name, activity: DeviceActivityName) { super.eventWillReachThresholdWarning(event, activity: activity) // Handle the warning before the event reaches its threshold. } }
Posted Last updated
.
Post not yet marked as solved
0 Replies
48 Views
I am new to swift. This is my first app. What an i doing wrong. Device activity monitor extension is never being called. When i launch the app, I am able to pick the discouraged and encouraged apps. It immediately restrict the discouraged app which is expected. But the extension is never called. import SwiftUI import FamilyControls import ManagedSettings @main struct GetALifeApp: App { @UIApplicationDelegateAdaptor(AppDelegate.self) private var appDelegate @StateObject var model = MyModel.shared @StateObject var store = ManagedSettingsStore() var body: some Scene { WindowGroup { ContentView() .environmentObject(model) .environmentObject(store) } } } class AppDelegate: NSObject, UIApplicationDelegate { func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil) -> Bool { initiateAsyncSetup() return true } private func initiateAsyncSetup() { Task { do { try await AuthorizationCenter.shared.requestAuthorization(for: .individual) MySchedule.setSchedule() } catch { print("Error during asynchronous setup: \(error)") } } } } import Foundation import FamilyControls import ManagedSettings private let _MyModel = MyModel() class MyModel: ObservableObject { let store = ManagedSettingsStore() @Published var selectionToDiscourage: FamilyActivitySelection @Published var selectionToEncourage: FamilyActivitySelection init() { selectionToDiscourage = FamilyActivitySelection() selectionToEncourage = FamilyActivitySelection() } class var shared: MyModel { return _MyModel } func setShieldRestrictions() { let applications = MyModel.shared.selectionToDiscourage store.shield.applications = applications.applicationTokens.isEmpty ? nil : applications.applicationTokens store.shield.applicationCategories = applications.categoryTokens.isEmpty ? nil : ShieldSettings.ActivityCategoryPolicy.specific(applications.categoryTokens) } } import Foundation import DeviceActivity extension DeviceActivityName { static let daily = Self("daily") } extension DeviceActivityEvent.Name { static let encouraged = Self("encouraged") } let schedule = DeviceActivitySchedule( intervalStart: DateComponents(hour: 0, minute: 0), intervalEnd: DateComponents(hour: 23, minute: 59), repeats: true ) class MySchedule { static public func setSchedule() { print("Setting schedule...") print("Hour is: ", Calendar.current.dateComponents([.hour, .minute], from: Date()).hour!) let events: [DeviceActivityEvent.Name: DeviceActivityEvent] = [ .encouraged: DeviceActivityEvent( applications: MyModel.shared.selectionToEncourage.applicationTokens, threshold: DateComponents(second: 2) ) ] let center = DeviceActivityCenter() do { print("Try to start monitoring...") try center.startMonitoring(.daily, during: schedule, events: events) } catch { print("Error monitoring schedule: ", error) } } } import SwiftUI struct ContentView: View { @State private var isDiscouragedPresented = false @State private var isEncouragedPresented = false @EnvironmentObject var model: MyModel var body: some View { VStack { Button("Select Apps to Discourage") { isDiscouragedPresented = true } .familyActivityPicker(isPresented: $isDiscouragedPresented, selection: $model.selectionToDiscourage) Button("Select Apps to Encourage") { isEncouragedPresented = true } .familyActivityPicker(isPresented: $isEncouragedPresented, selection: $model.selectionToEncourage) } .onChange(of: model.selectionToDiscourage) { newSelection in MyModel.shared.setShieldRestrictions() } } } struct ContentView_Previews: PreviewProvider { static var previews: some View { ContentView() .environmentObject(MyModel()) } } import Foundation import DeviceActivity import ManagedSettings class MyDeviceActivityMonitor: DeviceActivityMonitor { let store = ManagedSettingsStore() override func intervalDidStart(for activity: DeviceActivityName) { print("intervalDidStart") super.intervalDidStart(for: activity) store.shield.applications = nil print("intervalDidStart") } override func intervalDidEnd(for activity: DeviceActivityName) { super.intervalDidEnd(for: activity) } override func eventDidReachThreshold(_ event: DeviceActivityEvent.Name, activity: DeviceActivityName) { super.eventDidReachThreshold(event, activity: activity) print("used encouraged") store.shield.applications = nil } override func intervalWillStartWarning(for activity: DeviceActivityName) { super.intervalWillStartWarning(for: activity) // Handle the warning before the interval starts. } override func intervalWillEndWarning(for activity: DeviceActivityName) { super.intervalWillEndWarning(for: activity) // Handle the warning before the interval ends. } override func eventWillReachThresholdWarning(_ event: DeviceActivityEvent.Name, activity: DeviceActivityName) { super.eventWillReachThresholdWarning(event, activity: activity) // Handle the warning before the event reaches its threshold. } }
Posted Last updated
.
Post not yet marked as solved
1 Replies
87 Views
Summary Hello Apple Developers, I've made a custom UITableViewCell that includes a UITextField and UILabel. When I run the simulation the UITableViewCells pop up with the UILabel and the UITextField, but the UITextField isn't clickable so the user can't enter information. Please help me figure out the problem. Thank You! Sampson What I want: What I have: Screenshot Details: As you can see when I tap on the cell the UITextField isn't selected. I even added placeholder text to the UITextField to see if I am selecting the UITextField and the keyboard just isn't popping up, but still nothing. Relevant Code: UHTextField import UIKit class UHTextField: UITextField { override init(frame: CGRect) { super.init(frame: frame) configure() } required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } convenience init(placeholder: String) { self.init(frame: .zero) self.placeholder = placeholder } private func configure() { translatesAutoresizingMaskIntoConstraints = false borderStyle = .none textColor = .label tintColor = .blue textAlignment = .left font = UIFont.preferredFont(forTextStyle: .body) adjustsFontSizeToFitWidth = true minimumFontSize = 12 backgroundColor = .tertiarySystemBackground autocorrectionType = .no } } UHTableTextFieldCell import UIKit class UHTableTextFieldCell: UITableViewCell, UITextFieldDelegate { static let reuseID = "TextFieldCell" let titleLabel = UHTitleLabel(textAlignment: .center, fontSize: 16, textColor: .label) let tableTextField = UHTextField() override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { super.init(style: style, reuseIdentifier: reuseIdentifier) configure() } required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } func set(title: String) { titleLabel.text = title tableTextField.placeholder = "Enter " + title } private func configure() { addSubviews(titleLabel, tableTextField) let padding: CGFloat = 12 NSLayoutConstraint.activate([ titleLabel.centerYAnchor.constraint(equalTo: centerYAnchor), titleLabel.leadingAnchor.constraint(equalTo: leadingAnchor, constant: padding), titleLabel.heightAnchor.constraint(equalToConstant: 20), titleLabel.widthAnchor.constraint(equalToConstant: 80), tableTextField.centerYAnchor.constraint(equalTo: centerYAnchor), tableTextField.leadingAnchor.constraint(equalTo: titleLabel.trailingAnchor, constant: 24), tableTextField.trailingAnchor.constraint(equalTo: trailingAnchor, constant: -padding), tableTextField.heightAnchor.constraint(equalToConstant: 20) ]) } } LoginViewController class LoginViewController: UIViewController, UITextFieldDelegate { let tableView = UITableView() let loginTableTitle = ["Username", "Password"] override func viewDidLoad() { super.viewDidLoad() configureTableView() updateUI() createDismissKeyboardTapGesture() } func createDismissKeyboardTapGesture() { // create the tap gesture recognizer let tap = UITapGestureRecognizer(target: self.view, action: #selector(UIView.endEditing)) // add it to the view (Could also add this to an image or anything) view.addGestureRecognizer(tap) } func configureTableView() { view.addSubview(tableView) tableView.layer.borderWidth = 1 tableView.layer.borderColor = UIColor.systemBackground.cgColor tableView.layer.cornerRadius = 10 tableView.clipsToBounds = true tableView.rowHeight = 44 tableView.delegate = self tableView.dataSource = self tableView.translatesAutoresizingMaskIntoConstraints = false tableView.removeExcessCells() NSLayoutConstraint.activate([ tableView.topAnchor.constraint(equalTo: loginTitleLabel.bottomAnchor, constant: padding), tableView.leadingAnchor.constraint(equalTo: view.leadingAnchor, constant: padding), tableView.trailingAnchor.constraint(equalTo: view.trailingAnchor, constant: -padding), tableView.heightAnchor.constraint(equalToConstant: 88) ]) tableView.register(UHTableTextFieldCell.self, forCellReuseIdentifier: UHTableTextFieldCell.reuseID) } func updateUI() { DispatchQueue.main.async { self.tableView.reloadData() self.view.bringSubviewToFront(self.tableView) } } } extension LoginViewController: UITableViewDelegate, UITableViewDataSource{ func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { return 2 } func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { let cell = tableView.dequeueReusableCell(withIdentifier: UHTableTextFieldCell.reuseID, for: indexPath) as! UHTableTextFieldCell let titles = loginTableTitle[indexPath.row] cell.set(title: titles) cell.titleLabel.font = UIFont.systemFont(ofSize: 16, weight: .bold) cell.tableTextField.delegate = self return cell } } Again thank you all so much for your help. If you need more clarification on this let me know.
Posted Last updated
.
Post not yet marked as solved
0 Replies
40 Views
I have added the Journaling Suggestions capability and now I am trying to import journaling suggestions in my app so I can use it, but I am getting the ' No such Module' error, I have quit Xcode and opened it again, I am getting the same issue . I am running Xcode version 15.3
Posted Last updated
.
Post not yet marked as solved
1 Replies
124 Views
Hello. I'm trying to copy files to iOS device into my app's data container from mac and I can't get user name right. What is my user name? I have tried user name as I see it in Settings and also tried my apple ID with no luck. I use the following command: xcrun devicectl device copy to --device VALID_DEVICE_ID --domain-type appDataContainer --user "WHAT SHOULD BE HERE?" --domain-identifier VALID_BUNDLE_ID --source Data.zip --destination Documents/Data.zip Thank you in advance!
Posted
by xAlexDevx.
Last updated
.
Post not yet marked as solved
2 Replies
102 Views
I am trying to disable the screenshot on iOS app but apple does not expose any api for this. Due to which I added a workaround when iPhone will try to take screenshot we have a textfield in secured way which will cover the whole screen and screenshot will be blank. Does anyone tried the same approach to avoid screenshot? if yes did apple act against those application or they reject if they find. It will be great help if Apple can provide us some insight on it.
Posted Last updated
.
Post not yet marked as solved
0 Replies
86 Views
In order to fetch the unexpected pop-up dialog window when executing e2e tests. For example: I write a simple Apple script get_popup_windows.scpt as follows: tell application "System Events" tell process "SystemUIServer" set securityAlertWindows to (every window whose subrole is "AXDialog") set securityAlertTitles to {} repeat with securityAlertWindow in securityAlertWindows set securityAlertTitle to (securityAlertWindow's title as text) set end of securityAlertTitles to securityAlertTitle end repeat end tell end tell return securityAlertTitles However, when I execute osascript get_popup_windows.scpt It returns empty even when there is a popup window in my mac. Does anyone know the reason? Thanks for help. Will
Posted
by willkuo.
Last updated
.
Post not yet marked as solved
0 Replies
86 Views
Hello, I am working on a fairly complex iPhone app that controls the front built-in wide angle camera. I need to take and display a sequence of photos that cover the whole range of focus value available. Here is how I do it : call setExposureModeCustom to set the first lens position wait for the completionHandler to be called back capture a photo do it again for the next lens position. etc. This works fine, but it takes longer than I expected for the completionHandler to be called back. From what I've seen, the delay scales with the exposure duration. When I set the exposure duration to the max value: on the iPhone 14 Pro, it takes about 3 seconds (3 times the max exposure) on the iPhone 8 1.3s (4 times the max exposure). I was expecting a delay of two times the exposure duration: take a photo, throw one away while changing lens position, take the next photo, etc. but this takes more than that. I also tried the same thing with changing the ISO instead of the focus position and I get the same kind of delays. Also, I do not think the problem is linked to the way I process the images because I get the same delay even if I do nothing with the output. Is there something I could do to make things go faster for this use-case ? Any input would be appreciated, Thanks I created a minimal testing app to reproduce the issue : import Foundation import AVFoundation class Main:NSObject, AVCaptureVideoDataOutputSampleBufferDelegate { let dispatchQueue = DispatchQueue(label:"VideoQueue", qos: .userInitiated) let session:AVCaptureSession let videoDevice:AVCaptureDevice var focus:Float = 0 override init(){ session = AVCaptureSession() session.beginConfiguration() session.sessionPreset = .photo videoDevice = AVCaptureDevice.default(.builtInWideAngleCamera, for: .video, position: .back)! super.init() let videoDeviceInput = try! AVCaptureDeviceInput(device: videoDevice) session.addInput(videoDeviceInput) let videoDataOutput = AVCaptureVideoDataOutput() if session.canAddOutput(videoDataOutput) { session.addOutput(videoDataOutput) videoDataOutput.videoSettings = [kCVPixelBufferPixelFormatTypeKey as String: kCVPixelFormatType_32BGRA ] videoDataOutput.setSampleBufferDelegate(self, queue: dispatchQueue) } session.commitConfiguration() dispatchQueue.async { self.startSession() } } func startSession(){ session.startRunning() //lock max exposure duration try! videoDevice.lockForConfiguration() let exposure = videoDevice.activeFormat.maxExposureDuration.seconds * 0.5 print("set max exposure", exposure) videoDevice.setExposureModeCustom(duration: CMTime(seconds: exposure, preferredTimescale: 1000), iso: videoDevice.activeFormat.minISO){ time in print("did set max exposure") self.changeFocus() } videoDevice.unlockForConfiguration() } func changeFocus(){ let date = Date.now print("set focus", focus) try! videoDevice.lockForConfiguration() videoDevice.setFocusModeLocked(lensPosition: focus){ time in let dt = abs(date.timeIntervalSinceNow) print("did set focus - took:", dt, "frames:", dt/self.videoDevice.exposureDuration.seconds) self.next() } videoDevice.unlockForConfiguration() } func next(){ focus += 0.02 if focus > 1 { print("done") return } changeFocus() } func captureOutput(_ output: AVCaptureOutput, didOutput sampleBuffer: CMSampleBuffer, from connection: AVCaptureConnection){ print("did receive video frame") } }
Posted
by Saturnyn.
Last updated
.
Post not yet marked as solved
10 Replies
17k Views
When archiving & exporting App with Xcode 13. The Frameworks of the created app will have their Info.plist modified. CFBundleShortVersionString is being changed to have the same value as the application version. Steps to reproduce: Create iOS App project with v1.0.0 Add dynamic framework dependencies. ex: Framework A v3.0.0, Framework B v12.0.0. Archive Project. Distribute app AppStore Connect Export Finish the rest of the process with default values. Investigate generated IPA file Investigate .app file inside IPA Investigate frameworks inside .app file. CFBundleShortVersionString of all the frameworks is 1.0.0
Posted Last updated
.
Post not yet marked as solved
0 Replies
79 Views
I have my app already in live before the privacy manifest introduced. Now, I want to migrate from cocoapods to Swift Package Manager. Will this be considered like adding the third party SDKs as new ones or will it be considered existing ones? So far I have not received any emails from Apple regarding the privacy manifest. I do not want any issues with the privacy manifest.
Posted
by Sneha0110.
Last updated
.
Post not yet marked as solved
0 Replies
56 Views
Hello everyone, I hope you're all doing well. I'm reaching out to seek guidance on automating a task that involves sending 50 messages simultaneously using data stored in a Google Sheets document. Here's a brief overview of what I'm trying to achieve: I have a Google Sheets document containing pre-written messages along with associated recipient phone numbers. My goal is to automate the process of retrieving this data and sending the corresponding messages to each recipient in one click. While I'm familiar with using Shortcuts on my iPhone to automate certain tasks, I'm unsure about the best approach to handle this particular scenario. I've explored options such as using the "Get Content of URL" action to fetch data from the Google Sheets document, but I'm unsure how to proceed from there to automate the message sending process efficiently. If anyone has experience or insights on how to accomplish this task effectively using Shortcuts or any other automation tool, I would greatly appreciate your guidance. My aim is to streamline this process and save time by sending these messages automatically with just one click. Thank you in advance for any assistance or suggestions you can provide!
Posted
by AlexisFDK.
Last updated
.
Post not yet marked as solved
0 Replies
52 Views
This is a bug I have been trying to identify and fix for more than 3 weeks. This bug mostly happens in production. The stack trace doesn't help that much, because it looks like the app is crashing due to some SwiftUI internal methods. I tried everything in my power to debug and find this bug, still nothing. Due to the lack of 100% reproducibility, it made me think that this bug is either memory-pressure related or Swift concurrency related. When does it happen: This bug happens when presenting a SwiftUI modal (UIViewControllerRepresentable)[A] which in terms presents a UIHostingController modal[B] which then presents a modally a SwiftUI sheet [C] The bug happens somewhere around staying in [C] or after dismissing it. Context: The app lifecycle is SwiftUI. The main SwiftUI screen in the app body is a UIViewControllerRepresentable containing a UISplitViewController. Here is a screenshot from the crash log in Xcode. Anyone facing a similar issue?
Posted Last updated
.
Post not yet marked as solved
2 Replies
854 Views
I'm working on an app that has the following structure: MyApp MyWidgetExtension MyWatchKitApp -- MyWatchKitAppExtension ---- MyWatchKitAppWidgetExtension Both MyWidgetExtension and MyWatchKitAppWidgetExtension were developed using a shared MyWidgetBundle defined as follows: @main struct MyWidgetBundle : WidgetBundle However, I'm running into an issue when attempting to run this on devices with iOS 14. I get an error stating "App extensions must define either NSExtensionMainStoryboard or NSExtensionPrincipalClass keys in the NSExtension dictionary in their Info.plist." Interestingly, if I remove MyWatchKitAppWidgetExtension, the app installs just fine. But, if I add NSExtensionPrincipalClass or NSExtensionMainStoryboard, when I try to distribute the app to TestFlight, I receive an error stating "Unexpected key NSExtensionPrincipalClass found in extension Info.plist". I'm at a loss as to how to resolve this issue. Does anyone have any suggestions or insights?
Posted
by llmagicll.
Last updated
.
Post not yet marked as solved
2 Replies
723 Views
We're experiencing an issue on an iPhone 15 (iOS 17.1) where some video files can't be loaded from the results of a PHPickerViewController. results[index].itemProvider.loadFileRepresentation(forTypeIdentifier: UTType.movie.identifier) Gives error: Cannot load representation of type public.movie Video info (taken from Mac Finder): H.264 MPEG-4 AAC HD (1-1-1) 480x848px Filetype .MP4 Origin: Recorded on iPhone 14, sent over WhatsApp, & auto saved from WhatsApp to an iPhone 15 The iPhone 15 has iCloud enabled and the videos failing are frequently viewed and used in testing, so are likely to be downloaded/cached locally. I've tried changing the PHPickerConfiguration preferredAssetRepresentationMode to .current with no difference in the error. I've also tried using the openInPlace alternative but it complains that it's not supported in the debug output.
Posted
by Fordlum.
Last updated
.
Post not yet marked as solved
1 Replies
204 Views
Simulators will not install. Run destinations all empty. Can't even run on device. XCode 15.4 beta Sonoma 14.4.1 Intel Mac 16" MBP Attached screenshot of error. iOS 17.5 beta 2 (21F5058d) "Not compatible with XCode 15.4 beta" No run destinations appear. Not even 17.4 device that is plugged in. This all worked yesterday after initial XCode upgrade to 15.4 beta. Now all destinations are missing, even though they appear as installed in the 'Platforms' window. (yes I have rebooted and restarted XCode).
Posted
by a11y.
Last updated
.
Post not yet marked as solved
10 Replies
1.4k Views
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"]), ] )
Posted
by nickdnk.
Last updated
.