Have an app that has worked on iPhone/iPad. It uses WkWebView and evaluateJavaScript() to try to read the contents of a web page. However, when trying on my new Apple Silicon mac with the My Mac (Designed for iPad) option, it gives me the following error.
Error Domain=WKErrorDomain
Code=4 "A JavaScript exception occurred"
UserInfo={WKJavaScriptExceptionLineNumber=0, WKJavaScriptExceptionMessage=Cannot execute JavaScript in this document,
WKJavaScriptExceptionColumnNumber=0,
NSLocalizedDescription=A JavaScript exception occurred}
So, not really sure if it is really an Apple Silicon problem, or just that the running on the Mac is the problem and permissions are different.
Environment details:
Mac mini (M1, 2020)
macOS Big Sur Version 11.2.2
Xcode Version 12.4
Post
Replies
Boosts
Views
Activity
Created a brand new project with Xcode 12 beta 3. The following code, where I've swapped in for ContentView, works in Xcode 11, but not now. The problem is the List does not go into Edit mode. Cells bounce, but no remove icon (-) appears. The EditButton does change to "Done".
However, one can take any other action - add a cell with the "Add Item" button, or just swiping a cell to reveal "Delete" (don't have to actually delete). After the List has been "kicked" into action, the EditButton will now behave properly.
struct ContentView: View {
@State var myArray : [String] = ["One", "Two", "Three"]
func removeItems(at offsets: IndexSet) {
for index in offsets {
myArray.remove(at: index)
}
}
var body: some View {
NavigationView {
VStack {
Button(action: {
self.myArray.append("Other")
}) {
Text("Insert item")
}
List {
ForEach(myArray, id: \.self) { item in
VStack {
Text(item)
}
}.onDelete(perform: removeItems(at:))
}
}
.navigationBarItems(trailing: EditButton())
.navigationBarTitle("Navigation")
}
}
}
Can one get multiple buttons to work when included in a List row?This problem can be seen in the completed version of the Apple tutorial. There, the HikeDetail or HikeView each work when previewed by itself - one can select different graphs by the Elevation, Heart Rate, and Pace buttons. However, this view does not work properly when it is included in the ProfileSummary List(). When tapping on one of the buttons, the view collapses. This is because all buttons are activated, rather than just the one tapped.It seems that List() is deciding that if it sees a button in the row, it will change multiple behaviors: 1) The button is no longer tinted - if one uses a simple button, it is tinted outside of a List. (Note: The tutorial is playing with colors to show blue/gray - even in the List view). 2) The button no longer flashes when pressed/tapped. 3) A tap in the row activates the actions of all buttons included in that row.I can understand that this might be the desired behavior to make the simplest row - when only one button. But it is frustrating when one can no longer depend on the look or actions that one has built up at lower levels of the code, just because one now includes it in a List table.One partial workaround is to not use Button(), but rather add a tap or gesture to the view one has built up. But then one doesn’t get the helpful flash animation available in a button.Looking particularly for a way to get items 2 and 3 above to work together. Can work around item 1 like was done in the tutorial - but might be nice if this worked, too.