Posts under Developer Tools & Services topic

Post

Replies

Boosts

Views

Activity

How to correctly resolve URL bookmarks for use in Simulator UI tests?
To make UI testing easier and faster, I usually create URL bookmarks during normal app usage in the Simulator so that they can be instantly resolved on app launch during UI tests. For example, one of my apps allows browsing selected folders and stores bookmarks so they can be quickly opened again on following app launches, and instead of selecting the test folder each time at the beginning of the UI test, I select it once during normal app usage so that it's available immediately during the UI test. This usually works fine, but every now and then the UI tests fail because the tested app isn't able to resolve the stored bookmark. I don't know why this happens, but usually opening and closing the app again in the Simulator and re-running the UI tests solves the issue. The problem now is that I've just tried to setup some new UI tests for Apple Vision Pro Simulator and I'm never able to resolve bookmarks. So I created a sample project that reproduces the issue, and curiously enough the bookmarks don't even resolve when using an iPad Simulator (which usually works fine with my regular UI tests). What am I doing wrong? This can be reproduced with a default iOS project, embedding the default storyboard view controller in a navigation view controller, and this code: import UIKit class ViewController: UIViewController, UIDocumentPickerDelegate { override func viewDidLoad() { navigationItem.rightBarButtonItem = UIBarButtonItem(systemItem: .add, primaryAction: UIAction(handler: { _ in let picker = UIDocumentPickerViewController(forOpeningContentTypes: [.folder]) picker.delegate = self self.present(picker, animated: true) })) if let bookmark = UserDefaults.standard.data(forKey: "bookmark") { readBookmark(bookmark) } } func readBookmark(_ bookmark: Data) { do { let label = UILabel(frame: CGRect(x: 100, y: 100, width: 600, height: 100)) label.numberOfLines = 0 var stale = false let url = try URL(resolvingBookmarkData: bookmark, bookmarkDataIsStale: &stale) if !url.startAccessingSecurityScopedResource() { fatalError() } label.text = url.path view.addSubview(label) } catch { fatalError(error.localizedDescription) } } func documentPicker(_ controller: UIDocumentPickerViewController, didPickDocumentsAt urls: [URL]) { do { let url = urls[0] if !url.startAccessingSecurityScopedResource() { fatalError() } let bookmark = try url.bookmarkData() UserDefaults.standard.set(bookmark, forKey: "bookmark") readBookmark(bookmark) } catch { fatalError(error.localizedDescription) } } } And a default UI test, which always crashes because of the fatalError() in the catch clause of readBookmark(_:): final class problemUITests: XCTestCase { @MainActor func testExample() throws { let app = XCUIApplication() app.launch() } }
0
0
369
Oct ’24
Simple Xcode CLI/Swift project reflects nothing on change
Once I start a new project everything seems fine and the first commit is always successful. Once I change one of the parameters e.g. set TimeInterval = 6 any consequent run would do absolutely nothing, the only thing I can do is switch back to the old value or start a new project with the new values. I'm currently stuck, anything could help, thanks! import Foundation import CoreGraphics // A helper function to move the cursor smoothly from one coordinate to another. func moveCursor(from start: CGPoint, to end: CGPoint, duration: TimeInterval) { let steps = 100 // Number of steps for smoothness let delay = duration / TimeInterval(steps) // Time delay between each step for i in 0...steps { let progress = Double(i) / Double(steps) // Interpolating X and Y coordinates based on progress (linear interpolation) let newX = start.x + CGFloat(progress) * (end.x - start.x) let newY = start.y + CGFloat(progress) * (end.y - start.y) // Move the cursor let point = CGPoint(x: newX, y: newY) moveCursor(to: point) // Sleep for a short time to create a smooth movement usleep(useconds_t(delay * 1_000_000)) // usleep takes microseconds } } // Function to set the cursor position using CGEvent func moveCursor(to point: CGPoint) { let moveEvent = CGEvent(mouseEventSource: nil, mouseType: .mouseMoved, mouseCursorPosition: point, mouseButton: .left) moveEvent?.post(tap: .cghidEventTap) } // Main function to take multiple coordinates and move between them func moveCursorAlongPath(coords: [CGPoint], totalTime: TimeInterval) { guard coords.count > 1 else { return } let segmentTime = totalTime / TimeInterval(coords.count - 1) // Split time between segments for i in 0..<(coords.count - 1) { let start = coords[i] let end = coords[i + 1] moveCursor(from: start, to: end, duration: segmentTime) } } // Example usage: // Coordinates you want to move between let coordinates: [CGPoint] = [CGPoint(x: 100, y: 100), CGPoint(x: 400, y: 400), CGPoint(x: 800, y: 200)] let totalDuration: TimeInterval = 5 // Total duration in seconds // Move the cursor smoothly along the path moveCursorAlongPath(coords: coordinates, totalTime: totalDuration)``` ![]("https://developer.apple.com/forums/content/attachment/4482329e-42fd-423e-9f4c-860558eeef80" "title=Screenshot 2024-10-09 at 09.29.44.png;width=642;height=331")
0
0
164
Oct ’24
ktx compression method
I've been working on generating a KTX format cubemap using the xcrun realitytool image --generate-cube-map command, but I'm encountering an issue with the file size. The cubemap file ends up being around 128 MB(2k), which is too large for my needs. I'm hoping to get some advice on a few points: Is there any way to reduce the file size of the KTX cubemap generated with this command? I’d appreciate any tips on compression settings or alternative approaches that could help shrink the file size while retaining good quality. Is there any documentation available for this command? I've been exploring on my own, but a comprehensive guide would be helpful. Are there alternative methods for converting textures to the KTX format? If anyone has experience with other tools or workflows that work well for this, please share!
0
0
262
Oct ’24
Cannot get Xcode archive Distribution to install on iOS Device
When I airdrop my archived app to my device it runs perfectly. But when I try to share with colleagues using the manifest.plist in a website link, the app will not install (Even on the same device where the airdropped app did). I get "Unable to Install [app name]" Any help with this will be appreciated. Here is my manifest.plist: `<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>items</key> <array> <dict> <key>assets</key> <array> <dict> <key>kind</key> <string>software-package</string> <key>url</key> <string>https://www.scorcent.com</string> </dict> <dict> <key>kind</key> <string>display-image</string> <key>url</key> <string>https://www.scorcent.com/image_57x56.png</string> </dict> <dict> <key>kind</key> <string>full-size-image</string> <key>url</key> <string>https://www.scorcent.com/image_512x512.png</string> </dict> </array> <key>metadata</key> <dict> <key>bundle-identifier</key> <string>ScorCent</string> <key>bundle-version</key> <string>6.0</string> <key>kind</key> <string>software</string> <key>platform-identifier</key> <string>com.apple.platform.iphoneos</string> <key>title</key> <string>NO REGRETS</string> </dict> </dict> </array> </dict> </plist> `And here is my web url; <a href=itms-services://?action=download-manifest&url=https://www.scorcent.com/manifest.plist" Install App
0
0
190
Oct ’24
Screen Capture ReplayKit: How do I know if user had consented for Screen Capture alert?
I understand that there are no delegate methods for this. But to determine a positive consent from user to Record Screen needs to be evaluated via block parameter. When user denies the permission by mistake, and, if user tries again, the alert is not showing up. How do I reset the permission and throw the below alert again?
0
0
462
Oct ’24
Looking to Make a Unity Plugin for VisionOS
I'm using Unity to create a VisionOS project. Using Polyspatial. I want to be able to use WeatherKit. I can not seem to create a VisionOS plugin in Unity. I've found all sorts of resources for building one for iOS. I made small changes to convert to VisionOS, but no matter what I do, I get 'Undefined Symbol' errors when I try to build the XCode project. Most recently I used this github for reference https://github.com/Robert-96/unity-swift/tree/main Am i trying to do something that just isn't possible for VisionOS?
0
0
251
Sep ’24
How to fix this bug?
Hi everyone. Does anyone know how to fix this error message? It pops up when I try to build the code. Changing it from my phone to the simulator doesn't help. The project is located on my Desktop, and I have full read and write access to my Desktop. I can't figure out for the life of me how to fix it :(
0
0
213
Oct ’24
Sorting source code files in Xcode's navigator
Since Xcode 16 sorting source code files in the navigator with ascending order by name results in: A.hpp A.cpp B.hpp B.cpp ... Previous versions of Xcode sorted the files correctly (with respect to ascending order): A.cpp A.hpp B.cpp B.hpp Is this a bug or is there any parameter I have to set to get the old ordering back?
0
1
322
Oct ’24
Not being able to enroll to Apple Developer program
I am encountering an issue while trying to enroll in the Apple Developer Program. Every time I attempt to complete the enrollment process, I’m prompted to agree to the terms and conditions. However, after pressing “Agree,” I receive the error message: “Your enrolment could not be processed at this time.” This issue has been persistent for the past two days, and despite repeated attempts to complete the enrollment, I’m unable to proceed beyond the terms and conditions agreement. I’ve ensured that my account information is correct and that my payment method is up to date, but the problem continues. Any help or guidance would be greatly appreciated!
0
0
353
Sep ’24
“Unable to check for update” ios 18
Hi I am on an iphone 15 pro (US version) running ios 18 build number 22A5282m and the software update page of settings says that beta updates are off (cannot be turned on (there are no public or developer beta options either)) and the main page displays this error message: “Unable to Check for Update An error occurred while checking for a software update. Try Again“ <— in blue i tried to put my device into recovery mode to restore but it just started bootlooping and only stopped when i let go of the power button. next was the factory reset. i completely emptied the phone and set it up again. i restored from an earlier backup but the problem still remained. I am unable to update and my battery life is really suffering (3-4h of screen on time. Background app refresh and location services are turned off and low power mode is turned on) any ideas would be appreciated thanks
0
0
454
Sep ’24
Playground App not installed with update.
Like many of you, I installed the 18.2 iOS beta update for my new iPhone 16 Pro Max when it first came out. The Playground app was NOT installed with the update. I do have CleanUP in iPhoto, and I do have the new icon on the right of the Description field when i goto the emojis keyboard. When I click that icon, i get the option to request Early Access. Like many here, when I click that icon, I get the screen showing Early Access Requested. My concern is that the app Playground was not installed as part of my update. Has this happened to anyone else? Any thoughts other than reinstalling 18.2 ?? I combined a few screenshots to help elaborate.
0
0
1.7k
Oct ’24
Hang Reports Don't Add up to 100%
We have noticed that the hang reports provided in Xcode include the percentage of hang time, which are used to sort from high to low (effectively sorting by priority). However when adding these percentages up we do not get 100%. For newer releases the total may be quite low (5-20%) but even for older releases we only get up to around 85%. Are there reports we are missing? Is there a threshold or something that lower percentage reports are not hitting? Any level of understanding here would be appreciated!
0
0
412
Sep ’24
Unable to Connect Apple ID Binding and Payment on IPv6 Network, Need Solutions
Hi everyone, I'm experiencing issues with Apple ID binding and payment on an IPv6 network. I've tried multiple devices and networks, but the problem persists. I'm not sure if it's due to a lack of official support for IPv6. I have a few questions: 1.Has anyone successfully completed Apple ID binding and payment on an IPv6 network? 2.If there is no official support, are there any solutions or alternatives? For example, switching to IPv4 or other workarounds?
0
0
300
Oct ’24
UISearchBar Warnings in Xcode Version 16.0 w/ iOS 18.0
Explanation: I am working on an application and had trouble diagnosing the warnings below. I pulled the search bar code out into a separate project, and the warnings still show up. The entire code for the sample project is shown below. The "AddInstanceForFactory", "LoudnessManager", and "NSBundle" warning all show up immediately after tapping the search bar. The "RTIInputSystemClient" warning arises after tapping, dismissing, and re-tapping the search bar. Any help with resolving these warnings is appreciated! Warnings: "-[RTIInputSystemClient remoteTextInputSessionWithID:performInputOperation:] perform input operation requires a valid sessionID. inputModality = Keyboard, inputOperation = , customInfoType = UIEmojiSearchOperations" "NSBundle file:///Library/Developer/CoreSimulator/Volumes/iOS_22A3351/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS%2018.0.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/MetalTools.framework/ principal class is nil because all fallbacks have failed" "AddInstanceForFactory: No factory registered for id <CFUUID --------------> -----------------" "LoudnessManager.mm:709 unable to open stream for LoudnessManager plist" Code: import UIKit class SearchView: UIView { private lazy var searchBar: UISearchBar = { let searchBar = UISearchBar() searchBar.delegate = self searchBar.translatesAutoresizingMaskIntoConstraints = false searchBar.placeholder = "Search" return searchBar }() required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } init() { super.init(frame: .zero) translatesAutoresizingMaskIntoConstraints = false backgroundColor = .yellow addSubview(searchBar) NSLayoutConstraint.activate([ searchBar.topAnchor.constraint(equalTo: topAnchor, constant: 12), searchBar.leadingAnchor.constraint(equalTo: leadingAnchor, constant: 12), searchBar.trailingAnchor.constraint(equalTo: trailingAnchor, constant: -12), searchBar.bottomAnchor.constraint(equalTo: bottomAnchor, constant: -12), ]) } } extension SearchView: UISearchBarDelegate { func searchBar(_ searchBar: UISearchBar, textDidChange searchText: String) { print(searchText) } } class ViewController: UIViewController { private lazy var searchView = SearchView() override func viewDidLoad() { super.viewDidLoad() view.backgroundColor = .red let tap = UITapGestureRecognizer(target: self, action: #selector(dismissKeyboard)) view.addGestureRecognizer(tap) view.addSubview(searchView) NSLayoutConstraint.activate([ searchView.leadingAnchor.constraint(equalTo: view.leadingAnchor), searchView.topAnchor.constraint(equalTo: view.safeAreaLayoutGuide.topAnchor, constant: 24), searchView.centerXAnchor.constraint(equalTo: view.centerXAnchor), ]) } @objc func dismissKeyboard() { view.endEditing(true) } }
0
0
1k
Oct ’24
Alternative Ways to Contact Apple Developer Support
I’ve been trying to contact Apple Developer Support regarding my developer account. After submitting the required documents related to the Digital Services Act (DSA), I emailed them to ask which additional documents were needed. However, I’ve been waiting for more than 3 days now without receiving a response. Unfortunately, the only way for me to reach them is via email, as phone support is not available in my country. This delay is causing significant issues for me, and I need to resolve this as soon as possible. Are there any alternative methods to contact Apple Developer Support aside from email? I’d appreciate any advice or assistance.
0
0
431
Oct ’24
Apple Developer Account Purchase Stuck in Progress for 4 Days
Hi everyone, I recently made a purchase for my Apple Developer Account, and while I can see the transaction in my bank and have also received an email confirmation from Apple, my account status is still showing “In Progress” after almost 5 days. What’s worrying me is that some of my friends/colleagues who made the payment at the same time got their accounts activated almost immediately, while mine is still stuck. I’ve already reached out to Apple Support, but so far, I haven’t had any luck resolving the issue. Has anyone else experienced this kind of delay? Is there anything specific I should do, or should I just keep waiting it out? Thanks in advance for any advice or suggestions! Best, Erris
0
0
165
Sep ’24
Xcode: All Pull Request Changes + Code Review
I have the newest Xcode and macOS. When I'm trying to check Pull Request changes then when I click on any changed/added file, then instead of view with file I see infinite spinner. This happened in all files. I've tried to reinstall Xcode, macOS, clone new repo. This feature works once per 10-20 tries. Also when I try to manually compare uncommitted changes to some commit in Code Review mode, then I don't see any changes and no error appears. When I use git command line command in terminal, everything works and I receive changes. What can I do to fix this problem? I've tried Xcode 16.1 beta, and I can't go back to Xcode 15. Anyone has this problem? Anyone has any ideas?
0
1
365
Oct ’24
I have a issue for enrollment apple developer
hello sir i am student or i am apple developer i want to sell my app because i have created ios app but i am school student i am not any business or organization i am just a school or i do not have pass duns number i have to enroll For this I have to do my enrollment in educational institution accredited but it is asking for DUNS number or I do not have the pass so I request you to provide me DUNS number so that I can enroll or sell my app please I request you provide me...
0
0
155
Sep ’24