@State var position : MapCameraPosition = .userLocation(fallback: .region(.defaultRegion))
Map(position: $position) {}
.onAppear {
Timer.scheduledTimer(withTimeInterval: 1, repeats: true) { timer in
print("check.position",position.camera,position.region,position.rect,position.item)
}
}
All of the value are nil, so how do I get the current camera position??
check.position nil nil nil nil
check.position nil nil nil nil
check.position nil nil nil nil
check.position nil nil nil nil
check.position nil nil nil nil
check.position nil nil nil nil
check.position nil nil nil nil
check.position nil nil nil nil
It is always nil (even if I manually move around the Map with a finger)
Post
Replies
Boosts
Views
Activity
Whenever I start editing TextField or while editing TextField, Xcode shows this worning, and takes a few seconds to show the keyboard.
There is no 'availabilityDetailedInfo' in my source code, and I could not find similar errors on the internet.
Can't find or decode availabilityDetailedInfo
unavailableReasonsHelper: Failed to get or decode availabilityDetailedInfo
Can't find or decode reasons
unavailableReasonsHelper: Failed to get or decode unavailable reasons as well
Can't find or decode availabilityDetailedInfo
unavailableReasonsHelper: Failed to get or decode availabilityDetailedInfo
Can't find or decode reasons
unavailableReasonsHelper: Failed to get or decode unavailable reasons as well
Since httpRequest body is ignored on WKWebView, I am trying to display a php page by fetching the data first, and displaying it.
func fetchData() {
URLSession.shared.dataTask(with: request) {(data, response, error) in
guard let data, let url = request.url else {
return
}
// pass the result to WKWebView
}.resume()
}
import Foundation
import SwiftUI
import WebKit
struct CustomWebView: UIViewRepresentable {
var url: URL
var data: Data
func makeUIView(context: Context) -> UIView {
return CustomUIWebView(url: url, data: data)
}
}
class CustomUIWebView: UIView {
let webView: WKWebView
init(url: URL,data:Data) {
let webConfiguration = WKWebViewConfiguration()
webView = WKWebView(frame: .zero, configuration: webConfiguration)
super.init(frame: .zero)
webView.load(data, mimeType: "text/html", characterEncodingName: "utf-8", baseURL: url)
addSubview(webView)
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
override func layoutSubviews() {
super.layoutSubviews()
webView.frame = bounds
}
The data contains the page that display several images, but it doesn't display any of the images in WKWebView.
Test and other components (such as checkmark button) have no problem, only images do.
Also, I confirmed it works fine on Safari.
So what is the issue here?
What am I doing wrong?
I use this method.
webView.load(urlRequest)
but it seems the server receives empty httpBody.
I found threads about the simlar issue before iOS 11, but no recent one.
Is httpBody still ignored on iOS 17 and later?