这让我抓狂。iOS14 中似乎有处理背景图像的新行为。
期望的效果是:固定的背景图像填充屏幕,忽略安全区域,并且在键盘弹出时完全静态。相反,即使键盘从底部升起(?),键盘也会使图像向右滑动。
这是 SwiftUI 的错误吗?任何想法/解决方法表示赞赏。
产生这个的代码非常小:
import SwiftUI
struct ContentView: View {
@State var name = "Name"
var body: some View {
GeometryReader { geometry in
VStack {
TextField("Placeholder", text: $name)
}
.frame(width: geometry.size.width, height: geometry.size.height)
.background(
Image("bricks")
.resizable()
.scaledToFill()
.edgesIgnoringSafeArea(.all)
)
}
}
}
Run Code Online (Sandbox Code Playgroud) 我想检测 facebook 视频和 instrgram 视频 url 的视频 url,但 WKWebView 给出了 youtube 视频 url 我已经使用了 WKWebView 导航委托,它没有给出视频 url
webView!.addObserver(self, forKeyPath: "URL", options: .new, context: nil)
override func observeValue(forKeyPath keyPath: String?, of object: Any?, change: [NSKeyValueChangeKey : Any]?, context: UnsafeMutableRawPointer?) {
if let key = change?[NSKeyValueChangeKey.newKey] {
print("observeValue \(key)") // url value
}
}
Run Code Online (Sandbox Code Playgroud) 目标是使用新的 .fileImporter 修饰符加载 2 个不同的图像(图像 1 和 2)。
问题是我将相同的图像加载到两个缩略图(图像 1 和 2)。
有人设法使用 .fileImporter 修饰符做到这一点吗?
import SwiftUI
struct ContentView: View {
@State var openFile = false
@State var img1 = UIImage()
@State var img2 = UIImage()
@State var fileName = ""
var body: some View {
Form {
//image 1
Button(action: {
self.openFile.toggle()
}){
Image(uiImage: self.img1)
.renderingMode(.original)
.resizable()
.frame(width: 48, height: 48)
.clipShape(Circle())
}
//image 2
Button(action: {
self.openFile.toggle()
}){
Image(uiImage: self.img2)
.renderingMode(.original)
.resizable()
.frame(width: 48, height: 48)
.clipShape(Circle())
} …Run Code Online (Sandbox Code Playgroud) 我在我的项目中使用 Google Analytics SDK ( pod 'GoogleAnalytics') 已有 8 年了。它一直有效,直到我最近换了一台配备 M1 芯片的新 Mac。在新的 MacBook Pro 上,我可以在测试设备上构建并运行该应用程序。我还可以存档和分发该应用程序。但是当我尝试为 Xcode Simulator 构建应用程序时,它失败并显示以下消息:
ld: in /Pods/GoogleAnalytics/Libraries/libGoogleAnalytics.a(GAIUtil.o), building for iOS Simulator, but linking in object file built for iOS, file '/Pods/GoogleAnalytics/Libraries/libGoogleAnalytics.a' for architecture arm64
Run Code Online (Sandbox Code Playgroud)
我想继续使用 Google Analytics SDK,因为它提供了 Firebase(我也在使用)中缺少的功能,例如通过 API 免费下载数据的功能。
那么有什么方法可以修复在 Apple Silicon 上运行的 Xcode 模拟器的构建吗?
在 IOS 上也遇到了构建问题,“为 iOS 模拟器构建,但在为 iOS 构建的 dylib 中链接,文件‘.../platforms/ios/Pods/CouchbaseLite/iOS/CouchbaseLite.framework/CouchbaseLite’用于架构 arm64”
我目前使用的是nativescript 6.5.3 和cocoapod 1.10。采用M1芯片组。
现在我正在通过命令行为 ios 模拟器生成 xcode 构建
看起来像这样
xcodebuild -workspace Test.xcworkspace -sdk iphonesimulator -configuration Release -scheme TestProd
但为了让这个构建取得成功,我正在更改 Xcode 中的构建设置,例如排除 arch - Any iOS Simulator = arm64
谁能帮助我找到在命令行中执行此操作的正确参数,以便我可以避免手动执行此操作?
xCode 版本 12.1
我已经为我的 IOS 应用程序完成了质量扫描分析。我收到以下警告:
The binary has Runpath Search Path (@rpath) set. In certain cases an attacker can abuse this feature to run arbitrary executable for code execution and privilege escalation. Remove the compiler option -rpath to remove @rpath.
Run Code Online (Sandbox Code Playgroud)
我搜索@rpath并在我的代码pod-framework.sh和下面的代码中找到了:
# Embed linked Swift runtime libraries. No longer necessary as of Xcode 7.
if [ "${XCODE_VERSION_MAJOR}" -lt 7 ]; then
local swift_runtime_libs
swift_runtime_libs=$(xcrun otool -LX "$binary" | grep --color=never @rpath/libswift | sed -E s/@rpath\\/\(.+dylib\).*/\\1/g | uniq -u) …Run Code Online (Sandbox Code Playgroud) 我的 iOS 项目分为几个 SPM 模块。现在我想将其中一些作为 .xcframework 分发。
有没有办法从 SPM 模块自动创建 .xcframeworks?或者我可以使用一些(fastlane?)脚本来创建它们?
在我的 Xcode 自动更新到 12.4 后,我的 Rstudio 包编译中断并抛出以下错误:
ld: framework not found CoreFoundation
collect2: error: ld returned 1 exit status
Run Code Online (Sandbox Code Playgroud)
我尝试过重新安装 Xcode 命令行工具;禁用csrutil,然后手动创建链接,但这些尝试均无济于事。我真的很感激任何帮助!
我们正在运行 Xcode 12.4,并且在运行 XCUITest 测试时不断随机看到以下错误:
The test runner exited with code -1 before finishing running tests
Run Code Online (Sandbox Code Playgroud)
我们可以重新运行失败的测试,它们就会通过。有谁知道这个错误的原因或如何修复它?直到我们从 11.3 升级到 12.4 后我才看到它,但不确定它是否是 12.4 特有的。