ProcessInfo.processInfo.isiOSAppOnMac;
Post
Replies
Boosts
Views
Activity
I found the issues adding .alert(isPresented: $showAlert) { Alert(
causes the app to crash when running on Mac Emulator for iPad
everything worked fine until I copied that piece of code over from my project.
struct ContentView: View {
var body: some View {
NavigationStack(path: $path) {
ZStack(alignment: .bottom) {
HStack {
TabView(
selection: $currentTab.onUpdate {}
) {
FriendsView()
.tabItem { Label("Follow", systemImage: "person.3.fill") }
.tag(TabPages.FriendTab)
.buttonStyle(.plain)
}
}
VStack {
Spacer().frame(minHeight: UIScreen.main.bounds.size.height * 0.70)
Text("Test")
Spacer().frame(minHeight: UIScreen.main.bounds.size.height * 0.15)
}
}
}
.toolbar(.hidden)
//
// The Alert Will cause a crash on Mac emulator
//
.alert(isPresented: $showAlert) {
Alert(
title: Text("Problem"),
message: Text(badMessage),
dismissButton: .default(Text("Dismiss"), action: {
fatalError("An error occurred. Exiting the app.")
})
)
}
FB16023943
I'm working on a minimal standalone program to duplicate the crash, but so far I have not been able to (i.e. it works).
The crash is only on a Mac running as an emulated iPad app, and is recent to the last 30 days. The app works fine on iPhone and iPad.
Not sure this is what you want, maybe it can help
private func setupOrientationNotification() {
cancellableOrientation = NotificationCenter.default
.publisher(for: UIDevice.orientationDidChangeNotification)
.compactMap { _ in
UIDevice.current.orientation
}
.sink { newOrientation in
if newOrientation == .faceUp || newOrientation == .faceDown {
// do nothing
} else {
self.orientation = newOrientation
orientation = newOrientation
}
}
}
private var cancellableOrientation: AnyCancellable? = nil
@Published var orientation
I wrote (copied) this months ago, don't ask me to explain it.
I just had the exact same problem.
I have not tried to run my iPhone App on the Mac for a month, but today I tried to for testing and it failed. It worked fine a month ago.
In the last month I have updated the Mac OS to 15.1.1 (24B91) and I am using XCode Version 16.1 (16B40)
deployment target is IOS 17.1
The iPhone has the latest Beta OS installed, but I am not using any new API in my code.
I am not using any video players in my app.
dyld[83622]: Symbol not found: OBJC_CLASS$_AVPlayerView
Referenced from: <7D70BC8F-8276-33E5-964D-86BD04CC082F> /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/Library/Debugger/libViewDebuggerSupport.dylib
Expected in: /System/iOSSupport/System/Library/Frameworks/AVKit.framework/Versions/A/AVKit
Type: stdio
Any help would be appreciated. I don't even know where to begin to debug/fix this
turned out to be programmer error, I was using a property in my calculations that hadn't been updated yet ( DOH )
any update ?
"iOS Apps on Mac, for Apple silicon Macs"
I can use "iOS Apps on Mac, for Apple silicon Macs" to run the release version of my app from the App Store, but I need some help on running a local development build.