标签: xcode12

Xcode 12. 无法使用不可用的运行时进行查找

无法在 Xcode 12.0 beta 中启动模拟器。只有选择了 SwiftUI 项目,模拟器才不会运行。自动预览也不起作用。

在此处输入图片说明

模拟器在 iOS 14.0 上运行。

有什么建议?

xcode simulator ios xcode12

8
推荐指数
1
解决办法
4028
查看次数

SwiftUI 无法添加 onChange 事件

我有一个视图,其中显示我的消息列表。每当添加新消息时,我想滚动到底部。我正在尝试添加一个onChange事件,ForEach但这会破坏我的代码并出现一些奇怪的错误:

在“Array”上引用实例方法“onChange(of:perform:)”要求“Message”符合“Equatable”

有时

编译器无法在合理的时间内对该表达式进行类型检查;尝试将表达式分解为不同的子表达式

当我删除onChange一切都符合要求时。

这是Message模型:

struct Message: Identifiable {
    var id = UUID()
    var text: String
    var createdAt: Date = Date()
    var senderID: String
    var seen: Bool
    
    init(dictionary: [String: Any]) {
        self.text = dictionary["text"] as? String ?? ""
        self.senderID = dictionary["senderID"] as? String ?? ""
        self.seen = dictionary["seen"] as? Bool ?? false
    }
}
Run Code Online (Sandbox Code Playgroud)

我在这里做错了什么?

'对于每个

struct MessagesView: View {
    @ObservedObject var messagesViewModel: MessagesViewModel
    
    var body: some View {
        VStack { …
Run Code Online (Sandbox Code Playgroud)

ios swift swiftui xcode12

8
推荐指数
1
解决办法
1万
查看次数

Xcode 无法生成 Swift UI 预览 - 由于内部错误,构建中止:planningFailed

我使用的是 Xcode 12 beta 2。我已经将我的库打包在 Swift Packages 中。DataModel出现在错误消息中的是其中之一,我当前的包WeatherView依赖于。

我可以很好地构建包,但 Swift UI 预览失败
在此处输入图片说明

build aborted due to an internal error: planningFailed("multiple configured targets of \'DataModel\' are being created for iOS Simulator")

----------------------------------------

SchemeBuildError: Failed to build the scheme "WeatherView"

unexpected service error: build aborted due to an internal error: planningFailed("multiple configured targets of \'DataModel\' are being created for iOS Simulator")

Build system information:
error: unexpected service error: build aborted due to an internal error: planningFailed("multiple configured targets …
Run Code Online (Sandbox Code Playgroud)

ios swift-package-manager swiftui xcode12

8
推荐指数
1
解决办法
966
查看次数

Xcode 12 中新多平台模板的共享单元测试

当您有一个多平台项目时,您如何测试代码的共享部分?我看到了针对 iOS 的测试和针对 macOS 的测试,但没有针对共享部分的测试。我想为我的应用程序的平台独立部分添加单元测试。

xcode unit-testing xcode12

8
推荐指数
2
解决办法
343
查看次数

无法在带有颤动的 iOS 14 上运行 ios 应用程序

我刚刚安装了 iOS 14 beta 并将 Xcode 更新到最新的 Version 12 beta 3。

*Unable to locate DeviceSupport directory with suffix 'DeveloperDiskImage.dmg'. This probably means you don't have Xcode installed, you will need to launch the app manually and logging output will not be shown! Could not run build/ios/iphoneos/Runner.app on 00008020-001338A20E01002E. Try launching Xcode and selecting "Product > Run" to fix the problem: open ios/Runner.xcworkspace*当我从flutter运行应用程序时出现错误 。

我可以从 Xcode 运行该应用程序,但是一旦 USB 电缆断开,该应用程序将无法打开/应用程序崩溃。

请帮助我找出问题所在并解决

flutter flutter-dependencies ios-permissions ios14 xcode12

8
推荐指数
1
解决办法
5189
查看次数

TableView Getter 的 Swift 5.3 编译器崩溃

在执行 xcodebuild 时,编译器在声明 tableView 的第一行下方崩溃。

var tableView: UITableView? {
    get {
        var table: UIView? = superview
        while !(table is UITableView) && table != nil {
            table = table?.superview
        }
        return table as? UITableView
    }
}
Run Code Online (Sandbox Code Playgroud)

这是编译器崩溃的堆栈跟踪

2. Apple Swift version 5.3 (swiftlang-1200.0.28.1 clang-1200.0.30.1)
3.  While evaluating request ExecuteSILPipelineRequest(Run pipelines { EarlyModulePasses, HighLevel+EarlyLoopOpt, MidModulePasses+StackPromote, MidLevel, ClosureSpecialize, LowLevel, LateLoopOpt, SIL Debug Info Generator } on SIL for TestApp.TestApp)
4.  While running pass #835 SILFunctionTransform "SimplifyCFG" on SILFunction "@$s10TestApp31EditProfileAboutMeTableViewCellC05tableH0So07UITableH0CSgvg".
 for getter for tableView …
Run Code Online (Sandbox Code Playgroud)

xcodebuild swift5 xcode12

8
推荐指数
1
解决办法
463
查看次数

自从更新到 xcode 12 以来,我无法在 UITableViewCell 中放置任何 UIControl

我有一个使用 tableview 的搜索表单。今天更新 Xcode 12 后,UISwitch、UITextField、UISlider 在嵌套在 UITableViewCell 中时不再工作。是否有一个属性发生了变化,我需要设置它才能再次工作?

为了确保这不仅仅是我的项目,我创建了一个新项目并在其中放置了一个 UITextField,但它也不起作用。

override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
    let cell = UITableViewCell()
    
    let textField = UITextField(frame: CGRect(x: 5, y: 5, width: 400.0, height: 25.0))
    textField.delegate = self
    textField.backgroundColor = .blue
    cell.addSubview(textField)

    return cell
}

override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
    print("this will get called even when selecting the UITextField")
}

func textFieldDidBeginEditing(_ textField: UITextField) {
    print("this is never called")
}
Run Code Online (Sandbox Code Playgroud)

uitableview uicontrol xcode12

8
推荐指数
1
解决办法
1482
查看次数

Xcode 身份验证失败,因为将 iOS 版本更改为 14 后未提供凭据

我将应用程序部署版本从 iOS 13 更改为 iOS 14,但在构建应用程序时遇到错误。

在此输入图像描述

尽管所有这些包都是公开的,但它一直在谈论没有提供凭据。我还设置了 github 凭据并一直使用它们。

我尝试删除 github 帐户,更改 ssh -> http,但似乎没有任何帮助。

当我尝试使用 Swift 包管理器添加新的公共包时,会发生同样的问题

在此输入图像描述

有什么建议么?

xcode xcode12

8
推荐指数
2
解决办法
6649
查看次数

如何将导出/导入通用类型标识符图标添加到 Xcode 12 项目?

我正在使用 Xcode 12,并且尝试为导出和导入过程添加通用类型标识符图标。

所以我尝试了以下方法来创建图标。

  1. 将 .png 文件添加到共享文件夹。
  2. 通过在线工具使用.png文件创建.icns文件并将其添加到项目中。
  3. 使用终端命令创建 .icns 文件iconutil -c icns icns.iconset

但是当我单击第一个屏幕截图的加号按钮时,

在此输入图像描述

它建议对话框中的三个文件,如第二个屏幕截图。

在此输入图像描述

如果我选择其中之一,它将不会出现在 GUI 中,并且更改不会应用于项目。请帮助我解决这个问题,我非常感谢您的反馈。

ios swift5 xcode12

8
推荐指数
1
解决办法
1754
查看次数

SwiftUI 预览打开麦克风

有谁知道如何阻止 swiftUI 预览打开麦克风?我在工作时戴着蓝牙耳机,每次预览启动时都会启用麦克风。这会降低我的音频质量,因为耳机会在播放和输入之间分配带宽。

我的解决方法是进入声音设置,然后将我的默认输入切换到我的网络摄像头或 macbook 本身。每次启用时,xcode 中的预览都会打开麦克风,这太奇怪了。

上下文:我有一个 MBP 2019 Xcode 12.4 Catalina

谢谢!

swift swiftui macos-catalina xcode12 swiftui-previews

8
推荐指数
1
解决办法
199
查看次数