Hi,
I have a gnarly crash that I don't understand how to fix. The issue is actually on the AppStore version of the app when I click on "Discover pro feature" button it should open a modal but instead it crashes. This app is an iPad app that works on a Mac M1 machine and crashes only in this configuration(don't crash on iPhone or iPad).
From my understanding the crash seems to be coming from SwiftUI.
I can only reproduce it on the store version on the dev version(freshly build) it does not crash.
Do you have any ideas to have a way to reproduce it? Maybe the ips file gives some insight into what is happening.
2022-06-13-112851.ips.txt
Thanks for your support,
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Subtype: KERN_INVALID_ADDRESS at 0x0000000000000000
Exception Codes: 0x0000000000000001, 0x0000000000000000
VM Region Info: 0 is not in any region. Bytes before following region: 4344676352
REGION TYPE START - END [ VSIZE] PRT/MAX SHRMOD REGION DETAIL
UNUSED SPACE AT START
--->
__TEXT 102f68000-102f6c000 [ 16K] r-x/r-x SM=COW ...ot.app/Sambot
Exception Note: EXC_CORPSE_NOTIFY
Termination Reason: SIGNAL 11 Segmentation fault: 11
Terminating Process: exc handler [20585]
Triggered by Thread: 0
Kernel Triage:
VM - pmap_enter failed with resource shortage
VM - pmap_enter failed with resource shortage
Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 ??? 0x0 ???
1 SwiftUI 0x1e2a9ca40 StateObject.Box.update(property:phase:) + 84
2 SwiftUI 0x1e314eec8 static BoxVTable.update(ptr:property:phase:) + 444
3 SwiftUI 0x1e314e11c _DynamicPropertyBuffer.update(container:phase:) + 104
4 SwiftUI 0x1e2dbf624 DynamicBody.updateValue() + 596
5 SwiftUI 0x1e2fff16c partial apply for implicit closure #2 in implicit closure #1 in closure #1 in closure #1 in Attribute.init<A>(_:) + 32
6 AttributeGraph 0x1cbb462d4 AG::Graph::UpdateStack::update() + 524
7 AttributeGraph 0x1cbb46844 AG::Graph::update_attribute(AG::data::ptr<AG::Node>, unsigned int) + 396
8 AttributeGraph 0x1cbb4d964 AG::Graph::input_value_ref_slow(AG::data::ptr<AG::Node>, AG::AttributeID, unsigned int, AGSwiftMetadata const*, unsigned char&, long) + 548
9 AttributeGraph 0x1cbb643c8 AGGraphGetValue + 240
10 SwiftUI 0x1e2b366d8 BindingActionDispatcher.modifier.getter + 76
11 SwiftUI 0x1e2b36a00 BindingActionDispatcher.updateValue() + 560
12 SwiftUI 0x1e2fff16c partial apply for implicit closure #2 in implicit closure #1 in closure #1 in closure #1 in Attribute.init<A>(_:) + 32
13 AttributeGraph 0x1cbb462d4 AG::Graph::UpdateStack::update() + 524
14 AttributeGraph 0x1cbb46844 AG::Graph::update_attribute(AG::data::ptr<AG::Node>, unsigned int) + 396
15 AttributeGraph 0x1cbb51f74 AG::Subgraph::update(unsigned int) + 876
16 SwiftUI 0x1e3142cb0 GraphHost.flushTransactions() + 428
17 SwiftUI 0x1e257f860 specialized closure #2 in UINavigationController.updateRootHost<A>(root:environment:transaction:) + 84
18 SwiftUI 0x1e2a00060 thunk for @escaping @callee_guaranteed () -> () + 28
19 SwiftUI 0x1e302d020 closure #1 in ViewRendererHost.render(interval:updateDisplayList:) + 1172
20 SwiftUI 0x1e3024618 ViewRendererHost.render(interval:updateDisplayList:) + 388
21 SwiftUI 0x1e32f1a20 _UIHostingView.layoutSubviews() + 260
Post
Replies
Boosts
Views
Activity
Hi,
I want to be able to have multiple layer of modal in SwiftUI like what you can do in UIKit.
When you run the code below(in playground) it will create layer upon layer of modal.
swift
import UIKit
import PlaygroundSupport
extension UIColor {
class func randomColor(randomAlpha: Bool = false) - UIColor {
let redValue = CGFloat(arc4random_uniform(255)) / 255.0;
let greenValue = CGFloat(arc4random_uniform(255)) / 255.0;
let blueValue = CGFloat(arc4random_uniform(255)) / 255.0;
let alphaValue = randomAlpha ? CGFloat(arc4random_uniform(255)) / 255.0 : 1;
return UIColor(red: redValue, green: greenValue, blue: blueValue, alpha: alphaValue)
}
}
class ModalViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
self.view.backgroundColor = UIColor.randomColor()
let button = UIButton()
button.backgroundColor = .clear
button.setTitle("Open", for: .normal)
button.setTitleColor(self.view.tintColor, for: .normal)
button.addTarget(self, action: #selector(presentModal(_:)), for: .touchUpInside)
button.sizeToFit()
button.center = self.view.center
self.view.addSubview(button)
}
@IBAction func presentModal(_ sender: UIButton) {
let presentee = ModalViewController(nibName: nil, bundle: nil)
self.modalPresentationStyle = .overCurrentContext
self.modalTransitionStyle = .flipHorizontal
self.modalPresentationCapturesStatusBarAppearance = true
self.present(presentee, animated: true, completion: nil)
}
}
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
let button = UIButton()
button.backgroundColor = .clear
button.setTitle("Open", for: .normal)
button.setTitleColor(self.view.tintColor, for: .normal)
button.addTarget(self, action: #selector(presentModal(_:)), for: .touchUpInside)
button.sizeToFit()
button.center = self.view.center
self.view.addSubview(button)
}
@IBAction func presentModal(_ sender: UIButton) {
let presentee = ModalViewController(nibName: nil, bundle: nil)
self.modalPresentationStyle = .overCurrentContext
self.modalTransitionStyle = .flipHorizontal
self.modalPresentationCapturesStatusBarAppearance = true
self.present(presentee, animated: true, completion: nil)
}
}
// Present the view controller in the Live View window
PlaygroundPage.current.liveView = ViewController()
I did tried various approach in SwiftUI but I didn't seems to find how to do it is anyone have an idea ?
Thanks,