当我使用我的应用程序时,有时会出现一个错误,它似乎是随机的(或者我没有弄清楚确切的时间......),然后我的所有列表都是空的(就像 CoreData 中没有任何内容一样)。但是如果我关闭我的应用程序并重新打开它,列表就会出现没有任何问题......
我搜索了关于这个问题的堆栈溢出,但对我来说什么都不清楚......
错误 :
CoreData: warning: 'CDDetail' (0x2815e8790) from NSManagedObjectModel (0x2841bb8e0) claims 'CDDetail'.
2020-11-13 19:16:48.329773+0100 OrientationEPS[33705:3479327] [error] error: +[CDDetail entity] Failed to find a unique match for an NSEntityDescription to a managed object subclass
CoreData: error: +[CDDetail entity] Failed to find a unique match for an NSEntityDescription to a managed object subclass
Run Code Online (Sandbox Code Playgroud)
加载持久容器:
class OriEPS {
lazy var persistentContainer: NSPersistentContainer = {
let container = NSPersistentContainer(name: "OrientationEPS")
container.loadPersistentStores { description, error in
if let error = error { …Run Code Online (Sandbox Code Playgroud) 我试图让我的用户在 ActionSheet 中选择拍照或从库中选择
在 Iphone 上运行良好,但在 iPad 上不行
在 Ipad 上:ActionSheet 位于屏幕顶部,并且不可读...
我在 StackOverflow 上读到的有关此问题的所有问题都在谈论崩溃(这不是我的情况)或早于 SwiftUI
我的代码:
struct AjoutView: View {
@State private var image : Image?
@State private var shouldPresentImagePicker = false
@State private var shouldPresentActionScheet = false
@State private var shouldPresentCamera = false
var body: some View {
VStack{
...
}
.sheet(isPresented: $shouldPresentImagePicker, onDismiss: loadImage) {
SUImagePickerView(sourceType: self.shouldPresentCamera ? .camera : .photoLibrary, image: self.$image, isPresented: self.$shouldPresentImagePicker, dispId: disp.id)
}
.actionSheet(isPresented: $shouldPresentActionScheet) { () -> ActionSheet in
ActionSheet(title: Text("Ajouter …Run Code Online (Sandbox Code Playgroud) 当我打开带有文本字段的工作表,并将焦点放在文本字段上时,会出现键盘并显示此消息:
2021-02-06 22:29:35.817858+0100 OrientationEPS[4026:269878] [LayoutConstraints] Unable to simultaneously satisfy constraints.
Probably at least one of the constraints in the following list is one you don't want.
Try this:
(1) look at each constraint and try to figure out which you don't expect;
(2) find the code that added the unwanted constraint or constraints and fix it.
(Note: If you're seeing NSAutoresizingMaskLayoutConstraints that you don't understand, refer to the documentation for the UIView property translatesAutoresizingMaskIntoConstraints)
(
"<NSAutoresizingMaskLayoutConstraint:0x6000030b3250 h=--& v=--& _UIButtonBarButton:0x7fea6492cf40.height == …Run Code Online (Sandbox Code Playgroud) 我正在尝试在画布上使用 ToolPicker,但这里有:
如何将文本、形状添加到画布上的 ToolPicker 中?
struct MyCanvas: UIViewRepresentable {
var canvasView: PKCanvasView
let picker = PKToolPicker.init()
func makeUIView(context: Context) -> PKCanvasView {
self.canvasView.tool = PKInkingTool(.pen, color: .black, width: 15)
self.canvasView.isOpaque = false
self.canvasView.backgroundColor = UIColor.clear
self.canvasView.becomeFirstResponder()
let imageView = UIImageView(image: UIImage(named: "badmintoncourt"))
let subView = self.canvasView.subviews[0]
subView.addSubview(imageView)
subView.sendSubviewToBack(imageView)
return canvasView
}
func updateUIView(_ uiView: PKCanvasView, context: Context) {
picker.addObserver(canvasView)
picker.setVisible(true, forFirstResponder: uiView)
DispatchQueue.main.async {
uiView.becomeFirstResponder()
}
}
}
Run Code Online (Sandbox Code Playgroud) 如何将项目设置为禁用(不可点击)但在我的 tabView 中可见?
TabView(selection: $selectedTab) {
Settings()
.tabItem {
Image(systemName: "gearshape.fill")
Text("Settings")
}.tag(1)
.disabled(true) // Not Working
Run Code Online (Sandbox Code Playgroud)