我的应用程序使用WKWebView在代码中设置的(这是因为iOS 10 中的这个错误):
final class HelpViewController: UIViewController {
// …
var webView: WKWebView!
override func viewDidLoad() {
super.viewDidLoad()
let webConfiguration = WKWebViewConfiguration()
webView = WKWebView(frame: .zero, configuration: webConfiguration)
webView.translatesAutoresizingMaskIntoConstraints = false
self.view.addSubview(webView)
let margins = view.layoutMarginsGuide
webView.topAnchor.constraint(equalTo: self.back.bottomAnchor).isActive = true
webView.rightAnchor.constraint(equalTo: margins.rightAnchor).isActive = true
webView.leftAnchor.constraint(equalTo: margins.leftAnchor).isActive = true
webView.bottomAnchor.constraint(equalTo: margins.bottomAnchor).isActive = true
webView.navigationDelegate = self
//…
}
Run Code Online (Sandbox Code Playgroud)
我的 UI 测试如下所示:
func test_helpButtonShowsHelpText() {
//…
let webView = shopEasyApp.webViews.element
let webViewExists = webView.waitForExistence(timeout: kDefaultUITestTimeout)
XCTAssert(webViewExists, "Web view …Run Code Online (Sandbox Code Playgroud) 如果您尝试在真实设备上运行该应用程序,
则会出现以下错误,并且无法执行。
为什么会出现这种情况?
是否有任何设置需要检查?
Unable to install "AppName"
Domain: com.apple.dtdevicekit
Code: -402653103
--
App installation failed
Domain: com.apple.dtdevicekit
Code: -402653103
Failure Reason: Could not inspect the application package.
User Info: {
DVTRadarComponentKey = 487927;
"com.apple.dtdevicekit.stacktrace" = (
0 DTDeviceKitBase 0x0000000122d066e7 DTDKCreateNSError + 109
1 DTDeviceKitBase 0x0000000122d06de9 DTDK_AMDErrorToNSError + 792
2 DTDeviceKitBase 0x0000000122d4656a __90-[DTDKMobileDeviceToken installApplicationBundleAtPath:withOptions:andError:withCallback:]_block_invoke + 164
3 DVTFoundation 0x0000000108a03156 DVTInvokeWithStrongOwnership + 73
4 DTDeviceKitBase 0x0000000122d46301 -[DTDKMobileDeviceToken installApplicationBundleAtPath:withOptions:andError:withCallback:] + 1589
5 IDEiOSSupportCore 0x0000000122bcea25 __118-[DVTiOSDevice(DVTiPhoneApplicationInstallation) processAppInstallSet:appUninstallSet:installOptions:completionBlock:]_block_invoke.352 + 4523
6 DVTFoundation 0x0000000108b343ba …Run Code Online (Sandbox Code Playgroud) 这里没有显示代码,但我想知道如何做到这一点。我试过用
.blur(radius: (20)
Run Code Online (Sandbox Code Playgroud)
在一个视图上,但它往往会模糊整个视图。包括文本和视图中的任何其他内容。默认背景颜色很好,我不想/不需要更改它(为了使应用程序与明/暗模式兼容)。我想让视图的背景稍微模糊/不透明,但我希望视图中的文本和按钮仍然保持完整和正常。有什么办法可以只模糊视图本身的背景颜色吗?
我试图创建一个 Hstack'd 卡片列表,也就是说,我想创建一系列行的滚动视图。每行将包含两个并排显示的视图的 HStack,并由一些列表数据结构初始化。
struct MyHStackView: View {
var myArray = [SomeStruct(1), SomeStruct(3), SomeStruct(4), SomeStruct(5), SomeStruct(6)]
var body: some View {
ScrollView(.vertical) {
VStack {
ForEach(0..<self.myArray.count) { index in
HStack {
SubView(myArray[index])
SubView(myArray[index+1])
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
唯一的问题是我当前的实现涉及数组的每个元素,stride新的 ForEach 中是否内置了一个函数,以便我可以索引数组上的每个其他元素以初始化行?你会如何处理这个问题?
我的 mac 已自动更新,重新启动后,由于“安装其他所需组件”对话框,我无法使用 Xcode。安装会提示输入密码,然后每次都会失败并显示相同的消息。日志提到一些证书已过期。
\n\n如何在不更新 Xcode 的情况下解决启动循环失败的问题?(目前我正在尝试将 Xcode 更新到 11.3 作为解决方法,不确定这是否有效)
\n\n\n\n\n\n\n\n2020-01-03 16:36:05+07 Alexanders-MacBook-Air Xcode[721]:Package\n 创作错误:发现没有顶级\n 捆绑包定义的 PackageInfo 捆绑包引用。将跳过捆绑包:\n 2020-01-03 16:36:05+07 Alexanders-MacBook-Air Xcode[721]:软件包:PKLeopardPackage\n 无法验证错误:Error Domain=PKInstallErrorDomain\n Code=102 "软件包 \xe2\x80\x9cMobileDevice.pkg\xe2\x80\x9d 不受信任。"\n UserInfo={NSLocalizedDescription=软件包 \xe2\x80\x9cMobileDevice.pkg\xe2\x80\x9d 不受信任。, NSURL =MobileDevice.pkg --\n file:///Applications/Xcode.app/Contents/Resources/Packages/,\n PKInstallPackageIdentifier=com.apple.pkg.MobileDevice,\n NSUnderlyingError=0x7fb0be138100 {错误域=NSOSStatusErrorDomain\n代码=-2147409654“CSSMERR_TP_CERT_EXPIRED”UserInfo={SecTrustResult=5,\n PKTrustLevel=PKTrustLevelExpiredCertificate,\n NSLocalizedFailureReason=CSSMERR_TP_CERT_EXPIRED}}}
\n
在 SwiftUI 中,我有一个 VStack,里面有一个 Rectangle。矩形会自动填充父 VStack,这对宽度很好,但我想让高度等于宽度,所以它是方形的。如何将纵横比设置为 1:1 或设置高度 = 宽度?
VStack {
Rectangle()
.frame(height: ?? ) // I want to make the height equal to width so it's square
Spacer()
Run Code Online (Sandbox Code Playgroud)
}
环境?Xcode 11.3.1/Swift 5
这是函数:
func lldbTest() {
var switchInt = 1
...// do something and set a break point here
if switchInt == 1 {
print("switchInt == 1")
} else if switchInt == 2 {
print("switchInt == 2")
}
}
Run Code Online (Sandbox Code Playgroud)
我在进入 if 语句之前进行调试,我在 lldb 中将 switchInt 更改为 2
e switchInt = 2
p switchInt
(Int) $R4 = 2
Run Code Online (Sandbox Code Playgroud)
但它仍然打印“switchInt == 1” 结果
我在 Xcode 11 中有一个项目,我将其存储在 github.com 上的远程存储库中,并在本地签出一份副本(就像在 github 上所做的那样)。正如 github 存储库中的典型情况一样,我的存储库README.md在项目的顶层有一个文件。
当我将该存储库拉到我的 Mac 上以在 Xcode 中处理该项目时,我会看到该存储库中的所有文件。然而,在 Xcode Project Navigator 中却没有README.md(从我的角度来看,这有点WTF,但 Xcode 所做的很多事情都给了我这种反应)。难道我做错了什么?我应该怎么做才能README.md在 Xcode 中看到该文件?
我可以成功做的一件事是 \xe2\x8c\x98O 打开文件,但是当文件就在那里显示时,这感觉有点迟钝。
\n我正在为我的 iOS 应用程序的一个奇怪的错误而苦苦挣扎。在 iOS 13 应用程序中使用模拟器时,它可以正常工作,但在使用 iOS 14 按钮时,开关和其他功能没有响应。控制台没有错误输出。我不明白为什么只有 XCode 11 和 iOS 14 才会发生这种情况。
这是一个片段,在View.
let logButton: UIButton = {
let button = UIButton()
button.translatesAutoresizingMaskIntoConstraints = false
button.setLogInButton()
button.setTitle(NSLocalizedString("log_in", comment: ""), for: .normal)
return button
}()
Run Code Online (Sandbox Code Playgroud)
在这里,我将目标分配给按钮。
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
initConstraints()
backgroundColor = UIColor().settingsTableViewCellColor()
logButton.addTarget(self, action: #selector(buttonLogInLogOut), for: .touchUpInside)
}
Run Code Online (Sandbox Code Playgroud)
有行动
@objc func buttonLogInLogOut(_ sender: UIButton){
print("Log in clicked")
delegate?.logInLogOutFunc(sender)
}
Run Code Online (Sandbox Code Playgroud)
正如我所说,按钮(开关和其他按钮)仅在 iOS 14 中没有响应。看起来targetActions不起作用。
感谢您提供任何帮助。问候马特
Please see attach image. In Xcode 11, Cocos2d-x giving error : Argument value 10880 is outside the valid range [0, 255] btVector3.h
Error coming for code line
y = bt_splat_ps(y, 0x80); // in file btVector3.h
Run Code Online (Sandbox Code Playgroud)