Here's a simple C++ program that echoes its arguments...
#include <stdio.h>
int main(int argc, char* argv[])
{
for (int i=0; i<argc; ++i) printf("%d %s\n", i, argv[i]);
}
This works as expected...
> ./test arg1 #arg2 arg3
0 ./test
1 arg1
2 #arg2
3 arg3
Running under lldb gives this...
> lldb ./test arg1 #arg2 arg3
(lldb) target create "./test"
Current executable set to '/Users/richard/Work/test' (arm64).
(lldb) settings set -- target.run-args "arg1" "#arg2" "arg3"
(lldb) run
Process 6138 launched: '/Users/richard/Work/test' (arm64)
0 /Users/richard/Work/test
1 arg1
Process 6138 exited with status = 0 (0x00000000)
I get the same if I quote the arguments, or if I add them to the run line. Stepping into main() we see the argv and args values are as though we only had the first argument. If I quote the second argument and add an initial space " #arg1" then it works.
I first saw this on an M1 running Sequoia 13.1. It am now on OS 13.3.
lldb --version
lldb-1600.0.39.109
Apple Swift version 6.0.3 (swiftlang-6.0.3.1.10 clang-1600.0.30.1)
Post
Replies
Boosts
Views
Activity
I was taking screenshots from my iPhone 12 using Xcode 14.0 using Debug > View Debugging > Take Screenshot from (my phone). I got the shutter sound, and the file was visible under Recents in Finder.
I found that this does not do anything on my current 14.1 version. I updated to 14.3 but that is the same.
My phone has developer mode on.
I got several copies of this error once when trying to take a snaphot, but not when I tried again, so it may not be relevant...
Could not signal service com.apple.WebKit.WebContent: 113: Could not find specified service
I have a Swift iPhone app with tabbed pages. One of the pages is a WKWebView of a PDF document...
import SwiftUI
import WebKit
struct WebView: UIViewRepresentable {
typealias UIViewType = WKWebView
var webView: WKWebView
init() {
webView = WKWebView()
webView.allowsBackForwardNavigationGestures = true
webView.load(URLRequest(url: Bundle.main.url(forResource: "ByEye", withExtension: "pdf")!))
}
func makeUIView(context: Context) -> WKWebView { webView }
func updateUIView(_ uiView: WKWebView, context: Context) { }
}
struct ManualView: View {
var webView = WebView()
var body: some View {
webView
}
}
struct ManualView_Previews: PreviewProvider {
static var previews: some View {
ManualView()
}
}
This works well for me, but it always goes back to the top of the document when the view is opened. This is a nuisance, as the user may be doing one of the exercises in the manual, and dabbling between the manual and the other pages.
The Apple documentation for interactionState suggests that this is the way to save the current view, but it does not say how. I cannot find any examples.
NB:
My app only runs in portrait mode. This is a good thing for this view, as it means I am not closing the page in one mode and opening it in another.
I am using Xcode 14.1 building for iOS 16.0 on an iPhone 12 mini.
You can get the browser to open a URL with one line of code...
Link("Info", destination: URL(string: "https://my.web.address/info.pdf")!)
You can compile and build this....
Link("Info", destination: Bundle.main.url(forResource: "info", withExtension: "pdf")!)
No errors or crashes, but it does nothing. The Bundle.main.url() reply makes sense within the application, but does not work in the browser, which is not in the application. This was a security feature to stop people pulling data from your application, according to an answer from about 10 years back.
I have written a WKWebView page within my application to display the file. This works, but it took a lot more than one line. I would have actually preferred my original solution, if there had been some way for me to mark certain files as suitable for public release. As well as the manual, I have a PDF test chart image, and a table of CSV data that I would like to make public like this. I could use a button in the app to open them in the browser, and the user could then save a copy when and where they wanted. The user gets to re-use their browser skills, and I write one line of code per file. Win-win, right?
Can we open a Bundled file in the browser using a Link using some trick I haven't found yet? Is there a good reason why we must not do this? Or what?
The iPadOS display Reference Mode is a large part of what I need for a colour measurement app I have written. I want to disable the Auto Brightness, True Tone, and other tools that vary the display brightness, and produce a given, known brightness. I can ask the user to disable all these, but I cannot test whether they are disabled within the app.
I have found that my iPhone display is close enough to sRGB that the differences when matching to my macBook are probably due to the difference in spectrum between OLED and LCD other than any errors in calibration. It does not matter to me if we cannot set my iPhone display values to the precision or the brightness range of the iPad Pro. We expect differences from metamerism when matching different spectra. The important thing for me is to get the display to the same brightness and white in some repeatable way.
Here's a cut-down example from my app (iOS 16.0, Xcode 14.0)...
Grid(horizontalSpacing:0, verticalSpacing:0) {
GridRow {
Text(" L :")
decimalTextField($L, fraction: 1).onSubmit() { setRGB() }
}
GridRow {
Text(" a :")
decimalTextField($a, fraction: 1).onSubmit() { setRGB() }
}
GridRow {
Text(" b :")
decimalTextField($b, fraction: 1).onSubmit() { setRGB() }
}
}
.background(SwiftUI.Color.black.opacity(0.3))
.cornerRadius(8)
.onLongPressGesture{
let pasteboard = UIPasteboard.general
let LABtxt = String(format:"Lab: %.1f %.1f %.1f\n", L, a, b)
pasteboard.string = LABtxt
}
I was expecting unprocessed gestures to be passed from a View to its container. In this example, decimalTextField is a TextField with a NumberFormatter. if you tap on the TextField then the keyboard should appear. If you do a Long Press, I would expect the TextField does not handle a Long Press, so it drops through to the Grid container.
When I add the onLongPressGesture() to the Grid, the TextFields in the Grid stop doing anything. Take it away, and they start working again.
Is this right? I can imagine reasons why the TextField might block or consume a Long Press event, and stopping the container seeing it, but I can't see how it would work the other way around.
I have just thought of a special case. Suppose you were in a TabView, and wanted to swipe from one view to another. You would not want a swipe to accidentally trigger some action within the view. You would want any swipe to be offered to the TabView container first.
Or is the model in my head wrong? Do we identify the gesture, and then see what is listening for it; or do both happen at the same time? Do we decide whether we have a tap or a double-tap and then act, or is it more complicated?
This is a question of style rather than programming. We can do anything with bits. My aim is to use the tools in a way that someone else would understand. So...
If I was on a device with a mouse, I might hover it over a button or a widget, and hope something like a tooltip popped up. You would not expect an immediate action, but might hope for some hopeful dialogue.
The nearest equivalent on a phone would seem to be the long press. This would see to have the slow deliberate "erm, what's this, exactly?" feeling that the hover does. You are holding your finger still so as not to swipe by accident. I feel this ought to bring up a Confirmation dialog, with the 'Cancel' option at the bottom. This would tell you what to do, and possibly offer a few actions, and always have an option for getting out without doing anything.
This is anathema to some designers. The dialogue is modal, so it interrupts the flow. The dialog text should be localised. I can understand these arguments, but I would argue that a Long Hold has already interrupted the flow. Is there anything else I ought to be using?
A Button has .help() but I can't get it to do anything. I assume this is a tooltip and mouse thing.
I could extend View to support a Long Hold tooltip, and leave them all over the place. This would seem to be a good way to go. But, if it is such a smart idea, why isn't it already there? IMHO the Path Less Travelled By is usually strewn with brambles, stinging plants, and rusty iron.
My grids expand widthways to take up all the space it can. I can stick it in a frame and limit the size. But is there a way to get the columns to shrink to fit the contents plus padding? That would be neater, and probably more robust if the text changes size.
FWIW most of my grids contain only text, and I don't use a lot of columns.
I am trying to write an iPhone app that puts up patches of colour with known CIE XYZ values in nits. This would allow you to match your monitor white at home, then carry it to work with you and stand it next to your work monitor. This app is aimed at the motion picture, but it will probably be free, or nearly so.
I cannot see a way to disable adaptive brightness or TrueTone from within the app. This is probably a bad thing to do anyway; my app has to live alongside other apps, and not burn out the screen trying to match impossible whites.
Is there, or can there be please please, some way to determine how bright the screen should be at that moment? If I am matching (say) a gray patch of the digital Macbeth chart as displayed on my home monitor to a patch on my home phone, it could tell me that RGB=1.0 ought to be 165 nits D65 (or whatever) when the colours match to my eye. Or even some undefined but consistent number that I can calibrate myself.
If I can get the current screen brightness, I should be able to get up to the maximum brightness with the adaptive white on. I don't want to weaken my case by asking for something silly - I can live without this extra 2x brightness range - but this may be a feature that already exists for hardware development. Suppose we programatically pretend the ambient light sensor was seeing bright sunlight. With that we could get peak brightness for short periods even if we were trying to match the white of an HDR monitor in a dark room.
I am using Xcode 14.0.1, and testing on an iPhone 12 mini with IOS 16.0.
My project target was IOS 14.0. I need something later for TagView according to the comments, so I set that to 16.0 in the project TARGETS > iOS Deployment Target, which updated the PROJECT > iOS Deployment Target.
I now get an error "The compiler is unable to type-check this expression in reasonable time; try breaking up the expression into distinct sub-expressions" when I build. The error line is " var body: some View { " so there is not a lot of clues to that. This is not a big project.
If I change the target 15.0 I get the same error. I tried Product > Clean Build Folder but that did not help.
If I change the target to 14.7 it builds, and runs.
Is there something extra I need to do when changing the target iOS major version?