I found a problem with the latest Xcode 13.2/13.2.1 when compiling SwiftUI if-#available structure. When building with Release mode, the app always crashes on an older system.
import SwiftUI
struct ContentView: View {
var body: some View {
List {
if #available(iOS 15.0, *) {
Text("Hello").badge(1)
} else {
Text("Hello") // 💥 always crash: iOS 14 + release mode
}
}
}
}
Sample crash log:
OS Version: iPhone OS 14.8.1 (18H107)
Release Type: User
Baseband Version: n/a
Report Version: 104
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Subtype: KERN_INVALID_ADDRESS at 0x0000000000000000
VM Region Info: 0 is not in any region. Bytes before following region: 4328914944
...
Termination Signal: Segmentation fault: 11
Termination Reason: Namespace SIGNAL, Code 0xb
Terminating Process: exc handler [54802]
Triggered by Thread: 0
Thread 0 name:
Thread 0 Crashed:
0 libswiftCore.dylib 0x00000001b0a74750 swift::ResolveAsSymbolicReference::operator()(swift::Demangle::__runtime::SymbolicReferenceKind, swift::Demangle::__runtime::Directness, int, void const*) + 124 (MetadataValues.h:1263)
1 libswiftCore.dylib 0x00000001b0a96018 swift::Demangle::__runtime::Demangler::demangleSymbolicReference(unsigned char) + 212 (functional:1880)
2 libswiftCore.dylib 0x00000001b0a92d04 swift::Demangle::__runtime::Demangler::demangleType(__swift::__runtime::llvm::StringRef, std::__1::function<swift::Demangle::__runtime::Node* (swift::Demangle::__runtime::SymbolicReferenceKind, swi... + 200 (Demangler.cpp:589)
3 libswiftCore.dylib 0x00000001b0a7a660 swift_getTypeByMangledNameImpl(swift::MetadataRequest, __swift::__runtime::llvm::StringRef, void const* const*, std::__1::function<swift::TargetMetadata<swift::InProcess> const* (unsigned int, unsi... + 496 (MetadataLookup.cpp:69)
4 libswiftCore.dylib 0x00000001b0a77ab0 swift::swift_getTypeByMangledName(swift::MetadataRequest, __swift::__runtime::llvm::StringRef, void const* const*, std::__1::function<swift::TargetMetadata<swift::InProcess> const* (unsigned int, u... + 604 (CompatibilityOverride.def:153)
...
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
Hello,
I found that ScrollViewProxy.scrollTo(_:anchor:) always crash on iOS 16 beta 1-7. As soon as the Section in the List changes, the ScrollViewProxy does not scroll properly to the specified cell. This issue only appeared on iOS 16.
Sample Code (for Xcode 14)
import SwiftUI
struct ContentView: View {
@State private var hideSection1 = false
var body: some View {
ScrollViewReader { scrollView in
List {
if !hideSection1 {
Section(header: Text("Section 1")) {
ForEach(1...10, id: \.self) { i in
Text("\(i)")
}
}
}
Section(header: Text("Section 2")) {
ForEach(11...20, id: \.self) { i in
Text("\(i)")
}
}
}
.safeAreaInset(edge: .bottom, spacing: 0) {
VStack {
// Crash Steps:
// 1. Tap "Go to 20", OK ✅
// 2. Hide Section 1
// 3. Tap "Go to 20" again <--- ☠️ crash
Button("Go to 20") {
withAnimation {
scrollView.scrollTo(20, anchor: .center)
}
}
Toggle("Hide Section 1", isOn: $hideSection1)
}
.padding()
.background {
Rectangle()
.fill(.ultraThinMaterial)
.ignoresSafeArea()
}
}
}
}
}
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
}
}
Crash Message
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Attempted to scroll the collection view to an out-of-bounds section (1) when there are only 1 sections. Collection view: <SwiftUI.UpdateCoalescingCollectionView: 0x13c88cc00; baseClass = UICollectionView; frame = (0 0; 390 844); clipsToBounds = YES; autoresize = W+H; gestureRecognizers = <NSArray: 0x60000323fc60>; backgroundColor = <UIDynamicSystemColor: 0x600002922dc0; name = systemGroupedBackgroundColor>; layer = <CALayer: 0x600003c2f260>; contentOffset: {0, -47}; contentSize: {390, 498.66666666666669}; adjustedContentInset: {47, 0, 129.66666666666674, 0}; layout: <UICollectionViewCompositionalLayout: 0x13c510ed0>; dataSource: <_TtGC7SwiftUI31UICollectionViewListCoordinatorGOS_19SelectionManagerBoxOs5Never__: 0x13c513670>>.'
Hello :)
My iOS project does not work with SwiftUI Preview in Xcode 14 beta. The project builds and runs fine, but Preview never works. The error message is as follows.
HumanReadableSwiftError
SettingsError: noExecutablePath(<IDESwiftPackageStaticLibraryProductBuildable:ObjectIdentifier(0x000060002ac3e880):'AppCenterCrashes'>)
I do use the AppCenterCrashes dependency in my project. But I'm not sure if this error message is accurate, because sometimes it reports other packages.
After I executed Generate Report, I found the following error in SerializationErrors.txt.
Error Domain=NSCocoaErrorDomain Code=516 "“LogCaffeineIntent.swift” couldn’t be linked to “Intermediates” because an item with the same name already exists." UserInfo={NSSourceFilePathErrorKey=/Users/gong/Library/Developer/Xcode/DerivedData/.../Build/Intermediates.noindex/HiCoffee.build/Debug-iphonesimulator/IntentsExtension.build/DerivedSources/IntentDefinitionGenerated/Intents/LogCaffeineIntent.swift, NSUserStringVariant=(
Link
), NSDestinationFilePath=/var/folders/lv/58r5dhv52j779_qn41gnq4c80000gn/T/previews-diagnostics-20220608-144336/Intermediates/LogCaffeineIntent.swift, NSFilePath=/Users/gong/Library/Developer/Xcode/DerivedData/.../Build/Intermediates.noindex/HiCoffee.build/Debug-iphonesimulator/IntentsExtension.build/DerivedSources/IntentDefinitionGenerated/Intents/LogCaffeineIntent.swift, NSUnderlyingError=0x600033223810 {Error Domain=NSPOSIXErrorDomain Code=17 "File exists"}}
The problem seems to be related to the Intent generation code. I don't know how to fix it yet.
Hello!
Two of my watch apps (HiCoffee and HiWater) occasionally have issues with complications not displaying properly on watchOS 9. I did NOT use the new WidgetKit to implement the complications, all the related code still uses the same previous ClockKit + SwiftUI.
I have observed several different types of wrong behaviors.
One specific complication cannot be displayed (rendered?), while others do work (from the same app). This indicates that my watch app is working properly.
All complications on the face cannot be displayed. But the app logs indicates it's running properly. In addition, when you long press the face to edit complications, yet it can be displayed normally.
Log shows CLKComplicationServer.sharedInstance().activeComplications always returns 0 no matter how many complications are added to the face. Also, the ComplicationController is NOT called by system. I'm not using WatchKit.
This part of the code in my app has been working properly for a long time and has not been changed. But after the release of watchOS 9, I received a lot of feedback from users with this problem. So I think the problem is in watchOS 9.
I haven't found a way to reproduce the problem yet. Any suggestions please?
Topic:
App & System Services
SubTopic:
Core OS
Tags:
watchOS
Watch Complications
Notification Center
ClockKit
In iOS 17 beta 4, the Live Activity on lock screen is always rendered in dark mode. The issue can be reproduced both on physical device and simulator.
The widget family obtained via @Environment(\.widgetFamily) is wrong when preview widgets in Xcode 13.3.
The problem can be reproduced by creating a default app project and a widget extension in Xcode 13.3.
I have a new Xcode project, and the git repository for this project contains a submodule. When I try to grant access to this submodule, App Store Connect refreshes the page directly due to an error encountered. The grant is not successful.
When I open the browser's Inspector, I can see that there are some requests in Network with 503 errors. I suspect that it is these errors that are causing the page to refresh.
This git submodule is working fine in my other Xcode Cloud projects, which I used to be able to configure properly. But not anymore, this new project's Xcode Cloud is not working at all because of this issue.
Reported: FB11548470
Hello,
In Xcode 15 beta 3, if a project embedded a Swift package (no matter static or dynamic), and the package has its own dependencies, the linker will always emit following warning:
ld: warning: duplicate -rpath '/Users/.../Library/Developer/Xcode/DerivedData/MyApp.../Build/Products/Debug-iphonesimulator/PackageFrameworks' ignored
The warning is not appeared on beta 2 and beta 1.
Reproduce Steps
[1] Create a new iOS project in Xcode 15 beta 3
[2] Create a new Swift package MyLibrary, and add any dependency in the Package.swift. Example:
// swift-tools-version: 5.9
import PackageDescription
let package = Package(
name: "MyLibrary",
platforms: [.iOS(.v16)],
products: [
.library(name: "MyLibrary", targets: ["MyLibrary"]),
],
dependencies: [
// 👀 Add any dependency to this package.
// Here I use "Version" which is a simple pure swift package:
.package(url: "https://github.com/mxcl/Version.git", .upToNextMajor(from: "2.0.0")),
],
targets: [
.target(name: "MyLibrary", dependencies: ["Version",]),
]
)
[3] In the project page, embed MyLibrary into the iOS app target.
[4] Build the project. It will succeed but with link warnings.
In addition, if you create a dynamic framework and embed MyLibrary, the warnings also reproduce. And this is only a simple case. In my real project, the linker will also emit a lot of warnings like this:
ld: warning: could not associate debug note to atom l_OBJC_LABEL_PROTOCOL_$__TtP10SPConfetti18SPConfettiDelegate_
ld: warning: could not associate debug note to atom l_OBJC_PROTOCOL_REFERENCE_$__TtP10SPConfetti18SPConfettiDelegate_
ld: warning: could not associate debug note to atom l_OBJC_LABEL_PROTOCOL_$_NSURLSessionDelegate
ld: warning: could not associate debug note to atom l_OBJC_LABEL_PROTOCOL_$_NSURLSessionTaskDelegate
ld: warning: could not associate debug note to atom l_OBJC_LABEL_PROTOCOL_$_NSURLSessionDataDelegate
ld: warning: could not associate debug note to atom l_OBJC_LABEL_PROTOCOL_$_NSURLSessionDownloadDelegate
ld: warning: could not associate debug note to atom l_OBJC_LABEL_PROTOCOL_$_NSObject
ld: warning: could not associate debug note to atom l_OBJC_PROTOCOL_REFERENCE_$_NSURLSessionDelegate
ld: warning: could not associate debug note to atom l_OBJC_PROTOCOL_REFERENCE_$_NSURLSessionTaskDelegate
ld: warning: could not associate debug note to atom l_OBJC_PROTOCOL_REFERENCE_$_NSURLSessionDataDelegate
ld: warning: could not associate debug note to atom l_OBJC_PROTOCOL_REFERENCE_$_NSURLSessionDownloadDelegate
ld: warning: could not associate debug note to atom l_OBJC_PROTOCOL_REFERENCE_$_NSObject
Hello everyone! I found that the Xcode Cloud workflows under my project are completely stuck. The tasks that are already running cannot be completed. Newly started tasks remain in the queued state forever and cannot be canceled. They are consuming my usage quota 😢. Has anyone else encountered the same issue?
In Xcode 15 beta 6, building any Mac Catalyst project will encounter the following Linker warning.
ld: warning: building for 'macCatalyst', but linking in dylib (/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/Cocoa.framework/Versions/A/Cocoa.tbd) built for 'macOS'
I used ProgressView to display a countdown progress bar in a Live Activity. However, I found that since iOS 16.2, ProgressView(timerInterval:countsDown:) does not update properly in the following situations.
on Dynamic Island (either Expanded or CompactLeading/Trailing)
on the Locked Screen, after the display is turned off (isLuminanceReduced == true)
In these situations, the ProgressView for the countdown is always displayed at 100% and does not automatically update with the time. The problem only occurs in iOS 16.2. And it's confusing for users. Will it be fixed please?
Hello,
In WidgetKit, I have to write multiple #Preview macros for each family the widget supports. So is there any better way to write the #Preview?
(Although I can use the legacy PreviewProvider but it does not support timeline to test transition animation.)
#import WidgetKit
#import SwiftUI
struct DailyCaffeineWidget: Widget {
...
}
@available(iOS 17.0, *)
#Preview("Inline", as: .accessoryInline) {
DailyCaffeineWidget()
} timelineProvider: {
previewTimelineProvider()
}
@available(iOS 17.0, *)
#Preview("Circular", as: .accessoryCircular) {
DailyCaffeineWidget()
} timelineProvider: {
previewTimelineProvider()
}
@available(iOS 17.0, *)
#Preview("Rectangular", as: .accessoryRectangular) {
DailyCaffeineWidget()
} timelineProvider: {
previewTimelineProvider()
}
@available(iOS 17.0, *)
#Preview("Small", as: .systemSmall) {
DailyCaffeineWidget()
} timelineProvider: {
previewTimelineProvider()
}
@available(iOS 17.0, *)
#Preview("Medium", as: .systemMedium) {
DailyCaffeineWidget()
} timelineProvider: {
previewTimelineProvider()
}
...
This is new in Xcode 15 beta 5. Command SwiftCompile emitted errors but did not return a nonzero exit code to indicate failure.
error: Invalid Swift parseable output message (malformed JSON): `0` (in target 'HiCoffee' from project 'HiCoffee')
error: Invalid Swift parseable output message (malformed JSON): `1` (in target 'HiCoffee' from project 'HiCoffee')
error: Invalid Swift parseable output message (malformed JSON): `{
"kind": "finished",
` (in target 'HiCoffee' from project 'HiCoffee')
"name": "compile",
"pid": -1139,
"process": {
"real_pid": 95136
},
"exit-status": 0
}
Command SwiftCompile emitted errors but did not return a nonzero exit code to indicate failure
Hello everyone!
When I run UI Tests on Xcode Cloud, I often encounter unexpected failures. Checking the screen recording, I found that the iOS Simulator could go into a black screen with a white Apple logo and a progress bar for a period after the test starts. This behavior of the Simulator causes my app's UI Tests to fail randomly, which greatly affects the practical use of UI Tests.
I suspect this phenomenon is unrelated to my app and test cases, so I'm asking if anyone else has encountered a similar issue. 🤔
Hello,
When an iOS app runs on Vision Pro in compatible mode, is there a flag such as isiOSAppOnVision to determine the underlying OS at runtime? Just like the ProcessInfo.isiOSAppOnMac. It will be useful to optimize the app for visionOS.
Already checked but not useful:
#if os(xrOS) does not work in compatible mode since no code is recompiled.
UIDevice.userInterfaceIdiom returns .pad instead of .reality.
Thanks.