If I use the Swift 5.0.1. toolchain from swift.org within XCode 11, will this make binaries that can be uploaded to App Store and be compatible with frameworks compiled using XCode 10.3 with its default toolchain?If not, why not?Does that answer depend on whether I have the debug symbols installed?If so, why?ThanksO_G
Post
Replies
Boosts
Views
Activity
We have adopted a redux pattern. That means we return false in UITextField's "shouldReplaceCharacters inRange" function. From there we dispatch an UpdateStateAction to our ReSwift store. Then once the reducers have updated the state, we set a new state on our UI. As part of setting the new state, we'll call "textField.text = newValue" on whatever text field was being edited.
Sadly, when you wholesale replace the text on the text field in this way, it resets the insertion point to the end of the text field.
Is there any way to override this annoying behavior? It seems to occur due to the following private method being called under the hood by the private class, UIFieldEditor:
_setAttributedTextInRange:replacementText:andSetCaretSelectionAfterText
How can we avoid this ever being called?
I have found the only valid workaround to be, saving the selected text range's start position as a UITextPosition of the field before the change, and making sure to offset it by however many characters are being added, then to update the selectedTextRange after calling "text = newValue".
However this is kludgy and we don't like it. It's very annoying for UITextField to have such a bizarre, mysterious hidden behavior and seemingly no way to override it.
Surely I'm overlooking some thing?
Thanks
PS—The only workaround I found was this answer from five years go on an unrelated StackOverflow question from six and a half years ago: https://stackoverflow.com/a/29195723/12587089
Does the compiler remove "Preview" types from the shipped application?
Thanks.
We use a SwiftUI ForEach (using an "id" property on some elements of an array) to render a form with various text fields.
Initially the accessibility sort priority of all these text fields starts as the default 0.00. However when the user submits the form, if there are any validation errors on their entries, we increase the sort priority to 1.00 for the fields with errors, with the goal that the VoiceOver focus would jump to the highest-priority element after the view refreshes.
However, it flat out doesn't work: after changing the accessibility sort priority, nothing actually changes for the user of the app—accessibility still goes in the exact same order as if the sort priority did not exist, and there seems to be no way in SwiftUI to programmatically force the accessibility focus to jump to a particular field that needs attention, or cause a particular field to become the first responder, etc.
A major goal of our project is to see how much we can do in SwiftUI without resorting to using any UIKit APIs (other than UIHostingController), so please bear that in mind when suggesting a solution, thanks!
What are the proper macOS Security & Privacy that should be granted for Xcode to work properly on CI with Jenkins and Fastlane?
We have intermittent build failures causing about half of our CI builds to randomly fail in unpredictable ways. (See below for examples of the kinds of failures we get on about half our builds.)
So my question is: other than installing Xcode, is there anything else we need to do in order to make sure that the system can be used to build software via Jenkins and Fastlane?
Like do we need to add Xcode to "Developer Tools" in System Preferences > Security & Privacy > Privacy tab? What else do we need to add to that tab for Jenkins and Fastlane not to have all these problems?
All our build nodes are Mac Pros with 32 GB RAM so I know that hardware and resources aren't the problem.
We couldn't get 11.3 to work on Catalina at all, and at WWDC Apple told us that it was because the new Xprotect was attacking the simulators and it was fixed in Xcode 11.4 and later.
However many of the log messages we're seeing for the failures with 11.5 are the same exact log messages we were seeing when 11.3 would fail on Catalina.
It reminds me of an immune disease where antibodies attack healthy tissue.
As well, our unit tests often run extremely slow causing test failures due to timeouts. There is no apparent reason for this either.
I don't know why these issues are intermittent. I don't know why they are happening.
Please help.
Examples of the build failures:
One log message I see a lot is, os_unix.c:43353: (2) open(/var/db/DetachedSignatures) - No such file or directory
builtin-RegisterExecutionPolicyException /Users/jenkins/jenkins_workspace/build/ios/fastlane/output/derivedData/Build/Intermediates.noindex/ArchiveIntermediates/Redacted/InstallationBuildProductsLocation/Applications/Redacted.app
note: Execution policy exception registration failed and was skipped: Error Domain=NSPOSIXErrorDomain Code=1 "Operation not permitted" (in target 'Redacted' from project 'Redacted')
Or we'll have SimulatorTrampoline get a SIGKILL in the middle of test runs, and the error will say operation never finished bootstrapping, no restart will be attempted. Underlying error: test runner exited before starting test execution.
Or it'll be: Redacted.app (26246) encountered an error (Early unexpected exit, operation never finished bootstrapping - no restart will be attempted. (Underlying error: Crash: Redacted (26246): +[XCTWaiter handleStalledWaiter:]))
Sometimes it results in a dialog box showing up on the associated build node that says "Simulator quit unexpectedly. Click Reopen to open the application again." Clicking "show details" on that box led to a NSInternalInconsistency exception.
Or we'll get:
Aug 16 14:50:03 Mac-102 CoreSimulatorService[494] <Error>: Error Domain=com.apple.CoreSimulator.SimError Code=165 "Unable to lookup in current state: Shutting Down" UserInfo={NSLocalizedDescription=Unable to lookup in current state: Shutting Down}
Or we'll get:
Aug 16 14:49:57 Mac-102 com.apple.CoreSimulator.SimDevice.FE9C2901-932B-416E-8931-41C1A5FE09FC[42746] (com.apple.xpc.launchd.domain.pid.testmanagerd.42775): Failed to bootstrap path: path = /Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 13.4.simruntime/Contents/Resources/RuntimeRoot/usr/lib/dyld_sim, error = 2: No such file or directory
Aug 16 14:49:57 Mac-102 com.apple.CoreSimulator.SimDevice.FE9C2901-932B-416E-8931-41C1A5FE09FC[42746] (com.apple.xpc.launchd.domain.pid.LogArchiveCollector.43535): Failed to bootstrap path: path = /Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 13.4.simruntime/Contents/Resources/RuntimeRoot/usr/lib/dyld_sim, error = 2: No such file or directory
Or we'll get: codesign cannot open file at line errors.
Or we'll get: [2020-08-16T21:54:41.468Z] Error Domain=IDEProvisioningErrorDomain Code=9 ""Redacted.app" requires a provisioning profile with the Associated Domains, iCloud, and Push Notifications features." UserInfo={IDEDistributionIssueSeverity=3, NSLocalizedDescription="Redacted.app" requires a provisioning profile with the Associated Domains, iCloud, and Push Notifications features., NSLocalizedRecoverySuggestion=Add a profile to the "provisioningProfiles" dictionary in your Export Options property list.}
Hi,
Our CI pipeline has 2013 Mac Pros running two Catalina VMs each using VMWare ESXi. Each VM is currently configured with macOS Catalina 10.15.5, Xcode 11.5, Jenkins, and Fastlane. Each VM is allotted exactly half the CPU cores and RAM of the host machine.
We've been experiencing intermittent build failures where some tests take too long to run and timeout, and sometimes network requests to fetch provisioning profiles also fail.
I'm wondering if perhaps we should reduce the CPU & RAM allotment to each VM in order to increase the resources available to the underlying host?
Or does anyone know of any fundamental flaws with this kind of setup that might contribute to instability? If so is there any other supported way to handle multiple simultaneous builds per machine?
We're just trying to take maximal advantage of the hardware available on our pipeline.
Thanks in advance for any tips/advice!
(Please see this post - https://developer.apple.com/forums/thread/657532 for details on the kinds of build issues we've been seeing.)
What's the best way to know when a user is editing a SecureField in SwiftUI?
Our normal way of detecting this is via an .onTapGesture modifier attached to the SecureField.
However if the user is using a hardware keyboard, they don't have to tap into the field. Instead they can use arrow keys or tab to select a particular SecureField and begin editing it, in which case our .onTapGesture event does not happen.
I've been looking for an event like .onBeginEditing, or .willBeginEditing, however I don't see that there's any modifiers like this available for SecureField.
Our designers want us to change the border thickness of the field that's currently being edited so it's obvious, and of course we want to scroll that field into view if it's off-screen. How can we do stuff like this in SwiftUI with SecureField?
Thanks.
Why is Xcode 12.0.1 only available via Mac App Store?
How can we programmatically disable the app-specific localization setting from Settings.app > MyApp (feature that was introduced in iOS 13)?
The problem is, our app receives a localization preference sent by the server after the user logs in. The initial loading screen of the app would use the device's default language/region, but after the user logs in, we switch to whatever the user's account-level language/region settings are (as provided from our remote server).
The reason we do this is because our app is used in settings where multiple users share a single device, but they don't all speak the same language. It's assumed that the owner of the device dictates the login screen language by setting up the device with a particular language. And then after a user logs in, they get an experience that is tailored to their specific language.
We don't want to require each user to have to switch to the Settings app in order to switch the language every time they log in.
Please advise, thanks!
Our fastlane Xcode builds are failing intermittently when run by Jenkins. About 10% of builds, while running test targets, we'll get a failure with:
[2020-11-16T16:12:10.276Z] 2020-11-16 08:11:47.435 xcodebuild[72478:2549553] [MT] IDETestOperationsObserverDebug: 415.317 elapsed -- Testing started completed.
[2020-11-16T16:12:10.276Z] 2020-11-16 08:11:47.435 xcodebuild[72478:2549553] [MT] IDETestOperationsObserverDebug: 0.000 sec, +0.000 sec -- start
[2020-11-16T16:12:10.276Z] 2020-11-16 08:11:47.435 xcodebuild[72478:2549553] [MT] IDETestOperationsObserverDebug: 415.317 sec, +415.317 sec -- end
[2020-11-16T16:12:10.276Z] Testing failed:
[2020-11-16T16:12:10.276Z] REDACTED_iPhoneTests:
[2020-11-16T16:12:10.276Z] REDACTED.app encountered an error (Failed to install or launch the test runner. If you believe this error represents a bug, please attach the result bundle at /tmp/build/jenkins-mobile-ios-develop-1107/ios/fastlane/output/derivedData/Logs/Test/Test-iPhoneSnapshotTests-2020.11.16_08-04-51--0800.xcresult. (Underlying Error: The request to open "com.REDACTED.REDACTEDapp" failed. The request was denied by service delegate (SBMainWorkspace) for reason: Busy ("Application cannot be launched because it has outstanding termination assertions"). (Underlying Error: The operation couldn’t be completed. Application cannot be launched because it has outstanding termination assertions.)))
In the simulator device logs we have a lot of "failed to bootstrap path" errors, where the report indicates that some path under Xcode-12.app cannot be found (even though in reality, it's there):
Failed to bootstrap path: path = /Applications/Xcode-12.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/dyld_sim, error = 2: No such file or directory
Nov 16 08:11:44 Mac-169 com.apple.CoreSimulator.SimDevice.4A33E878-D3F6-4EE4-AB53-7ACD59E0B8A5[73117] (com.apple.xpc.launchd.domain.pid.testmanagerd.73149): Failed to bootstrap path: path = /Applications/Xcode-12.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/IOKit.framework/Versions/A/IOKit, error = 2: No such file or directory
Nov 16 08:11:44 Mac-169 com.apple.CoreSimulator.SimDevice.4A33E878-D3F6-4EE4-AB53-7ACD59E0B8A5[73117] (com.apple.xpc.launchd.domain.pid.LogArchiveCollector.73942): Failed to bootstrap path: path = /Applications/Xcode-12.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/dyld_sim, error = 2: No such file or directory
Nov 16 08:11:44 Mac-169 com.apple.CoreSimulator.SimDevice.4A33E878-D3F6-4EE4-AB53-7ACD59E0B8A5[73117] (com.apple.xpc.launchd.domain.pid.LogArchiveCollector.73942): Failed to bootstrap path: path = /Applications/Xcode-12.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/IOKit.framework/Versions/A/IOKit, error = 2: No such file or directory
In Xcode 12.3 the list of prior simulator versions is empty, making it impossible to download prior iOS simulator versions.
How can I fix this? Or is it just an endemic bug that Apple allowed to slip into the release of Xcode 12.3?
Both myself and another engineer at my company have experienced the same issue. We are both on Catalina 10.15.7 (19H114).
We both installed Xcode 12.3 when it was in RC, but it's the same exact build as the official release (12C33).
Is Apple going to fix Xcode before 12.5?
Is there going to be a beta 4?
Swift Package Manager integration is still hopelessly broken in Beta 3. Targets with .binaryTarget still don't build in time to be linked with other targets; dynamic targets still build as static targets causing build errors; SPM still does deep clones of source repos making it take forever... (adding Firebase to our project takes 15 minutes before the UI is responsive and incurs a 20 minute delay to open the project without a cache).
I set up a new test target for my app useing Xcode Test Plans to specify an .xcappdata file to use for each target. We run the tests in iPad & iOS Simulators, which get recreated from scratch prior to each test run.
However, Xcode never actually copies over the app data (such as com.ourCompany.ourApp.plist, and other files) from the .xcappdata file into the appropriate directories of the simulator container in ~/Library/Developer/CoreSimulator/Devices/SIMULATED_DEVICE_GUID/data/Containers/Data/Applications/OUR_APP'S_CONTAINER_GUID/.
So our tests fail because, for example, a fresh app .plist gets generated instead of using the one from our .xcappdata, resulting in UserDefaults settings values not matching expectations.
Am I doing something wrong? How can we get this to actually work...?
I have found multiple other threads, such as this one on Apple Dev Forums from four years ago - https://developer.apple.com/forums/thread/43719?login=true&page=1#668295022, and several on Stack Overflow such as this post - https://stackoverflow.com/questions/47684823/including-application-data-in-ios-simulator, that indicate that this feature has been broken since at least Xcode 6.
But... didn't they just add the per-target .xcappdata feature as part of Test Plans in Xcode 11? How could it already be broken again in Xcode 12.3? Does Apple not to have tests around their own Test Plans feature?
I hope someone can enlighten me... is it a permissions issue? A regression due to Big Sur? Do I need to add some cryptic executable (buried within the uncountable subfolders in /Applications/Xcode.app/Contents/Some/Deeply/Nested/Toolchain/usr/bin) into Security & Privacy Privacy Full Disk Access?
Any help would be much appreciated... thanks!
I did find the following workarounds, but neither seems very scalable:
set the HOME and CFFIXED_USER_HOME environment variables to $(SRC_ROOT)/path/to/myData.xcappdata/AppData/ in the test scheme (this causes that folder to now become the simulated app's container directory, resulting in these files getting modified as a result of the tests running with this as their actual home instead of the usual container location!)
use a script to copy over the files from the subfolders nested inside .xcappdata into the same subfolders that are nested inside of ~/Library/Developer/CoreSimulator/Devices/SOME-GUID/data/Containers/Data/Applications/ANOTHER-GUID/ (of course since these GUIDs are random and determined at test time, how to write such a script and get it to work reliably on both CI machines [that execute tests using Fastlane scripts] and local developer machines [that execute tests from within Xcode], would be pretty annoying)
We have 75 Mac Pros in our own corporate datacenter that currently run our Jenkins instances for CI/CD. Can we repurpose these to serve as Xcode Cloud nodes for our builds, or does Xcode Cloud require that the builds occur on Apple's machines?
If it must be done on Apple's hardware, who is a security contact at Apple who we can get our security team in touch with to vet the Xcode Cloud service? Thanks
What's the difference between "isEditing", "focus", and "accessibility focus" in SwiftUI in iOS 15 SDK?
In iOS 13/14 SDKs, using a hardware keyboard, you can focus a different field than the one you're currently editing. One of the main difficulties in SwiftUI that we've had for iPad has been how to manage these kinds of situations, since for example, with SecureField, there's no hook for when it starts editing or when it becomes focused. So we had no way to customize the focused appearance of SecureField or even, programmatically set focus to password field if it had an error, scroll the view to make sure whichever field is now focused in visible, etc.
We found that "isEditing" and "isFocused" are two completely different things in iOS, and there's a third thing—"accessibility focus" which also needs to be kept track of. "Keyboard focus" is when you have a physical keyboard and you use tab to select a different field—this allows you to focus a different field than the one that's currently being edited!
But in the new SwiftUI "focus" system, it sounded like "isEditing" and "focused" are now being treated as the same thing? Is that correct? Can you no longer focus a different field than the one that's being edited with a keyboard? Is accessibility focus still a different thing??
Please clarify thanks!