我决定从将 MKMapView 包装到 UIViewRepresentable 中切换到Map()SwiftUI 中的新包装。
我能够MKMapRect在 中正确显示 a Map(),但无法MKPointAnnotation在那里显示 2。另外,我在这些注释之间的路线没有显示
它要求我提供一个RandomAccessCollection和一个(Identifiable) -> MapAnnotationProtocol>,但我不知道该放什么。
知道我应该放什么吗(Identifiable) -> MapAnnotationProtocol?
import SwiftUI
import MapKit
extension MKPointAnnotation: Identifiable { }
struct ItemView: View {
@ObservedObject var itemViewModel: ItemViewModel
@State var coll = [MKPointAnnotation]()
func onAppear() {
let requestAnnotation = MKPointAnnotation()
requestAnnotation.coordinate = CLLocationCoordinate2D(latitude: 46.2004781, longitude: 6.1346497)
requestAnnotation.title = "Package"
let destinationAnnotation = MKPointAnnotation()
destinationAnnotation.coordinate = CLLocationCoordinate2D(latitude: 47.1420446, longitude: 9.5204032)
destinationAnnotation.title = …Run Code Online (Sandbox Code Playgroud) 我对 Swift 和 SwiftUI 非常陌生,我正在尝试编写一个 iOS 应用程序来读取文件夹,计算每个文件的哈希值,然后将它们复制到外部驱动器。
现在我正在尝试导入一个文件并计算其哈希值。但是,我总是遇到同样的错误,说我没有查看它的权限。
这是我的代码:
//
// ContentView.swift
// FileExporter
//
// Created by adrien le falher on 27/09/2020.
//
import SwiftUI
import CryptoKit
struct ContentView: View {
@State private var document: MessageDocument = MessageDocument(message: "Hello, World!")
@State private var isImporting: Bool = false
@State private var isExporting: Bool = false
@State private var isMoving: Bool = false
var body: some View {
VStack {
GroupBox(label: Text("Message:")) {
TextEditor(text: $document.message)
}
GroupBox {
HStack {
Spacer() …Run Code Online (Sandbox Code Playgroud) Xcode 12当我尝试构建大型 iOS 应用程序(混合、swift+objc)时出现链接器错误。该应用程序在真实设备上构建得很好,但是当我尝试使用调试配置直接在模拟器中运行时,它会出现链接器错误。
我在这里的其他帖子中尝试了所有可能的解决方案,但不幸的是它没有奏效。尽管其他帖子中的错误有所不同。我已经检查Build for active architectures only了调试配置的 YES 和发布配置的 NO。
其他帖子错误,
为 iOS 模拟器构建,但链接为 iOS 构建的目标文件,用于架构 arm64
我的错误,
为 iOS 模拟器构建,但链接为 macOS 构建的目标文件,为体系结构 x86_64 构建的文件
我该如何解决这个问题?我需要在 iOS 真机和模拟器中运行。
我使用https://github.com/Carthage/Carthage/issues/3019#issuecomment-665136323创建了一个 SVProgressHUD 框架并添加到 Xcode 项目中。
xcodeproj 的常规选项卡的图像:

xcodeproj 的构建阶段选项卡的图像:

构建成功,但应用程序崩溃,也没有显示任何错误日志。
它显示 AppDelegate window]: unrecognized selector sent to instance 0x283840470"
我已经尝试过 StackOverflow 的各种解决方案,但没有任何效果。我正在使用最新版本的 Xcode:12.0.1 (12A7300) 并在具有最新操作系统 14.0.1 的 iPad 上运行该应用程序。
我该如何解决?帮我。提前致谢。
如果我在 Xcode 项目中打开其中一个故事板,我会收到此警报:
文档 [storyboard name] 有 4 个已发现并修复的问题。
这可能是由于 SCM 操作(例如合并)所致。请保存文档以解决问题。
多个资源具有相同的名称:groupTableViewBackgroundColor。
我尝试保存文档,但错误不断弹出。
这是什么,我该如何解决?
我正在使用 SwiftUI 开发 Note 应用程序。我想在 TextField 或 TextEditor 中突出显示选定的文本并获取突出显示的文本。
我搜索了很多,但没有找到任何解决方案。如果有人帮助,我非常感谢他
我正在尝试按照本教程创建仅出现在 MacOS Big Sur 菜单栏(右上角)中的应用程序:https : //medium.com/@acwrightdesign/creating-a-macos-menu-bar-application -using-swiftui-54572a5d5f87/。它在 Xcode 11 和 MacOS Catalina 上工作,因为有一个 AppDelegate.swift 文件,但我听说这被这个方法取代:
@main
struct MyApp: App {
var body: some Scene {
WindowGroup {
ContentView()
}
}
}
Run Code Online (Sandbox Code Playgroud)
但是,本教程的前几步要求我对(现在不存在的) AppDelegate.swift 文件进行一些更改。我已经尝试在 MyApp.swift 中进行这些更改,但我似乎无法让它工作。有没有人愿意帮我改编 MacOS Big Sur/Xcode 12 的教程?
注意:以下是 AppDelegate.swift 文件根据教程的外观(如果它存在)(如果您出于任何原因不想打开教程):
import Cocoa
import SwiftUI
@NSApplicationMain
class AppDelegate: NSObject, NSApplicationDelegate {
var popover: NSPopover!
var statusBarItem: NSStatusItem!
func applicationDidFinishLaunching(_ aNotification: Notification) {
// Create the SwiftUI view that provides the window contents.
let contentView …Run Code Online (Sandbox Code Playgroud) 我正在运行 XCode 12.4 和 iOS 13.7。下面,简单的类
import AudioKit
import UIKit
class SoundManager {
private var sampler: AKAppleSampler
private var booster: AKBooster
private var reverb: AKReverb
private let mixer: AKMixer
required init() {
sampler = AKAppleSampler()
booster = AKBooster(sampler, gain: 3.0)
reverb = AKReverb(booster)
mixer = AKMixer()
}
func setup() {
reverb.loadFactoryPreset(.largeRoom)
mixer.connect(input: reverb)
AKManager.output = mixer
try? AKManager.start()
}
}
Run Code Online (Sandbox Code Playgroud)
当被调用时
let soundManager = SoundManager()
soundManager.setup()
Run Code Online (Sandbox Code Playgroud)
与
HALB_IOBufferManager_Client::GetIOBuffer: 流索引超出范围 AQME.h:254:IOProcFailure: AQDefaultDevice (1): 输出流 0: 空缓冲区 AQMEIO_HAL.cpp:1774:IOProc: EXCEPTION throw (-50): error …
我正在尝试为 ios 构建并存档该应用程序。但我收到以下错误。我在 StackOverflow 和 google 上进行了搜索,但我的错误有点不同,我无法理解它。如果有人能帮助我那就太好了。
确切的错误:
Multiple commands produce
'/Users/sumantakundu/Library/Developer/Xcode/DerivedData/Globallove-emwwobuvdzgwhtbdhclymguzjmkg/Build/Intermediates.noindex/ArchiveIntermediates/Globallove/IntermediateBuildFilesPath/UninstalledProducts/iphoneos/AccessibilityResources.bundle':
1) Target 'React-Core-60309c9c-AccessibilityResources' has create directory command with output '/Users/sumantakundu/Library/Developer/Xcode/DerivedData/Globallove-emwwobuvdzgwhtbdhclymguzjmkg/Build/Intermediates.noindex/ArchiveIntermediates/Globallove/IntermediateBuildFilesPath/UninstalledProducts/iphoneos/AccessibilityResources.bundle'
2) Target 'React-Core-AccessibilityResources' has create directory command with output '/Users/sumantakundu/Library/Developer/Xcode/DerivedData/Globallove-emwwobuvdzgwhtbdhclymguzjmkg/Build/Intermediates.noindex/ArchiveIntermediates/Globallove/IntermediateBuildFilesPath/UninstalledProducts/iphoneos/AccessibilityResources.bundle'
Run Code Online (Sandbox Code Playgroud)
我使用的依赖项:
"dependencies": {
"@react-native-async-storage/async-storage": "^1.14.1",
"@react-native-community/masked-view": "^0.1.10",
"@react-native-cookies/cookies": "^6.0.4",
"@react-navigation/drawer": "^5.12.3",
"@react-navigation/native": "^5.9.2",
"@react-navigation/stack": "^5.14.2",
"react": "16.13.1",
"react-native": "0.63.4",
"react-native-gesture-handler": "^1.9.0",
"react-native-image-slider-box": "^1.0.12",
"react-native-ionicons": "^4.6.5",
"react-native-paper": "^3.6.0",
"react-native-reanimated": "^1.13.2",
"react-native-safe-area-context": "^3.1.9",
"react-native-screens": "^2.17.1",
"react-native-tableview-simple": "^4.2.1",
"react-native-vector-icons": "^8.0.0",
"react-native-webview": "^11.2.1",
"rn-webview": "^0.1.0"
Run Code Online (Sandbox Code Playgroud)
},
iOS Xcode 构建设置截图如下:
我的 POD 文件: …
我有一个用 swift 编写的应用程序。我想查看应用程序发布后的崩溃报告。我想为此添加 Firebase Crashlytics。我在这个链接中做了所有的事情。但在编译过程中我收到以下错误:
/bin/sh: /Users/durak/Library/Developer/Xcode/DerivedData/Kelimeci-auysdliostxzkgcllzdsmxabridn/Build/Intermediates.noindex/Kelimeci.build/Debug-iphonesimulator/Kelimeci.build/Script-65F1AA5C273CEB5C00F5B530.sh: /bin/shr: bad interpreter: No such file or directory
Command PhaseScriptExecution failed with a nonzero exit code
Run Code Online (Sandbox Code Playgroud)
我已经搜索了几个小时但找不到解决方案。我把pod拆下来重新安装了,还是不行。有什么问题吗,我哪里出错了?
Xcode 12.5
crashlytics swift firebase-crash-reporting xcode12 xcode12.5
xcode12 ×10
ios ×6
swift ×6
swiftui ×4
xcode ×3
audiokit ×1
carthage ×1
crashlytics ×1
file-import ×1
highlight ×1
ios14 ×1
objective-c ×1
react-native ×1
textfield ×1
xcode12.5 ×1
xcodebuild ×1