Post

Replies

Boosts

Views

Activity

Reply to JSON DATA CORRUPTED ERROR
The error message "Invalid value around line 1, column 0." is consistent with having invalid bytes at the very start of the file. Maybe there are some non-printing (invisible) characters there for some reason? (I initially thought byte order mark, but that seems to work fine.) Try examining the file directly via this command: $ hexdump -C <path-to-your-JSON-file> | head -1 The expected output is exactly this: 00000000  5b 7b 0a 20 20 20 20 22  4e 61 6d 65 22 3a 22 49  |[{.    "Name":"I| If the first character isn’t the opening square bracket, that’s bad. Let us know what it shows.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Jan ’22
Reply to "Content View" in a custom UIView, as in Cells
Is the goal to make your custom cell type (packaged in a library) acquire custom design-time behaviors like UIKit cell types when placed in a storyboard? That is, there would be a content view already present inside your main cell view in the storyboard? Unfortunately this sort of customization isn’t supported. The user can put your cell type into a storyboard (by dragging in a regular UIView and then changing the class name) but it will always just be a plain UIView as far as Xcode is concerned. You can let the user customize your cell in certain well-known ways of course, such as by IBOutlet (maybe require the user to install their own content view and hook it up to an outlet named contentView), and you can expose extra properties via IBInspectable or IBDesignable. By “implement it all yourself” I meant that at run time you could add behavior such as re-parenting all the user’s direct subviews into a custom content view that you create, setting up constraints to achieve a desired layout style, etc.
Topic: UI Frameworks SubTopic: UIKit Tags:
Jan ’22
Reply to "Content View" in a custom UIView, as in Cells
Is there any markup or protocol, that instructs Xcode to add views to view's "contentView" as it does for cells? Plain old views don’t have a concept of a content view. If you want to achieve a design similar to table cells or collection view cells, then you need to implement it all yourself.
Topic: UI Frameworks SubTopic: UIKit Tags:
Jan ’22
Reply to How can I compile this app?
The missing files are found in a couple of Git submodules which don’t seem to get cloned if you use GitHub’s Open with Xcode or Download ZIP options, or a normal git clone command. It works if you use git clone --recursive like this: $ git clone --recursive git@github.com:macmade/QEMU-Manager.git
Jan ’22
Reply to Erroneous output of a C++ program in MacOS that gives correct output on Windows PC
Off-by-one error: the 3rd argument to mergeSort needs to be the index of the last array element, not the array size. So you are actually sorting 14 elements including the garbage value past the end of the array, rather than 13 elements. The varying output depends on whether that garbage value sorts into the first 13 elements or not. If it always “works” on Windows then the stack may be pre-filled with a debug byte value that is always greater than 7, rather than random bytes seen on the Mac.
Jan ’22
Reply to Is there any down side to changing my CFBundleVersion from a 3 part number to a one part number.
It’s actually a good idea. Using dots is sort of a legacy format that still works, except in the case of Xcode 13’s new automatic build number management feature. That feature assumes CFBundleVersion is a simple integer and quietly truncates starting at the first dot. That’s what happened in your previous question. Consider CFBundleVersion as an internal build number. It doesn’t have to resemble your user-visible CFBundleShortVersionString in any way. You can reset it to (say) 1 every time you bump your CFBundleShortVersionString. And if you adopt the automatic build number feature, then you can just leave it alone and let Xcode bump it for you when uploading. Also consider the current documentation for CFBundleVersion to be obsolete. Someone should submit a feedback on that.
Jan ’22
Reply to Help with Xcode and curses
It’s something to make certain of us feel old. Or more specifically, “curses is a terminal control library for Unix-like systems, enabling the construction of text user interface (TUI) applications.” I recall trying to make a Hello World type of app using curses on my school’s state-of-the-art green-screen Zenith terminals around 1989, but didn’t yet have the C language skill to make much progress.
Jan ’22
Reply to Base64 encoding in JSContext
The atob() function is part of the window object in browser JavaScript, but there is no window object when using JSContext directly. One solution would be to implement the functionality in native code (Swift or Objective-C) and call it from JavaScript. See JSExport (link) and various online tutorials.
Topic: Safari & Web SubTopic: General Tags:
Dec ’21
Reply to wrong build number shown in AppStore connect
Adding a little to Deepa Pai’s correct answer, your bundle version got “incremented” to 302 because the new auto-managed version logic seems to consider only the first part of a dotted version string. So it considered both your old 301.3.12010 and your new 301.3.13061 to be equivalent to simply 301, therefore duplicate, so it incremented to produce 302.
Dec ’21
Reply to JSON DATA CORRUPTED ERROR
The error message "Invalid value around line 1, column 0." is consistent with having invalid bytes at the very start of the file. Maybe there are some non-printing (invisible) characters there for some reason? (I initially thought byte order mark, but that seems to work fine.) Try examining the file directly via this command: $ hexdump -C <path-to-your-JSON-file> | head -1 The expected output is exactly this: 00000000  5b 7b 0a 20 20 20 20 22  4e 61 6d 65 22 3a 22 49  |[{.    "Name":"I| If the first character isn’t the opening square bracket, that’s bad. Let us know what it shows.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Jan ’22
Reply to NSMeasurement not converting between UnitInformationStorage Correctly
That’s the correct and documented behavior: the kilobytes and megabytes units are powers of 10. For powers of 2, use kibibytes and mebibytes.
Topic: App & System Services SubTopic: General Tags:
Replies
Boosts
Views
Activity
Jan ’22
Reply to "Content View" in a custom UIView, as in Cells
Is the goal to make your custom cell type (packaged in a library) acquire custom design-time behaviors like UIKit cell types when placed in a storyboard? That is, there would be a content view already present inside your main cell view in the storyboard? Unfortunately this sort of customization isn’t supported. The user can put your cell type into a storyboard (by dragging in a regular UIView and then changing the class name) but it will always just be a plain UIView as far as Xcode is concerned. You can let the user customize your cell in certain well-known ways of course, such as by IBOutlet (maybe require the user to install their own content view and hook it up to an outlet named contentView), and you can expose extra properties via IBInspectable or IBDesignable. By “implement it all yourself” I meant that at run time you could add behavior such as re-parenting all the user’s direct subviews into a custom content view that you create, setting up constraints to achieve a desired layout style, etc.
Topic: UI Frameworks SubTopic: UIKit Tags:
Replies
Boosts
Views
Activity
Jan ’22
Reply to "Content View" in a custom UIView, as in Cells
Is there any markup or protocol, that instructs Xcode to add views to view's "contentView" as it does for cells? Plain old views don’t have a concept of a content view. If you want to achieve a design similar to table cells or collection view cells, then you need to implement it all yourself.
Topic: UI Frameworks SubTopic: UIKit Tags:
Replies
Boosts
Views
Activity
Jan ’22
Reply to How can I compile this app?
The missing files are found in a couple of Git submodules which don’t seem to get cloned if you use GitHub’s Open with Xcode or Download ZIP options, or a normal git clone command. It works if you use git clone --recursive like this: $ git clone --recursive git@github.com:macmade/QEMU-Manager.git
Replies
Boosts
Views
Activity
Jan ’22
Reply to Erroneous output of a C++ program in MacOS that gives correct output on Windows PC
Also check out session video Understanding Undefined Behavior from WWDC17.
Replies
Boosts
Views
Activity
Jan ’22
Reply to Erroneous output of a C++ program in MacOS that gives correct output on Windows PC
Off-by-one error: the 3rd argument to mergeSort needs to be the index of the last array element, not the array size. So you are actually sorting 14 elements including the garbage value past the end of the array, rather than 13 elements. The varying output depends on whether that garbage value sorts into the first 13 elements or not. If it always “works” on Windows then the stack may be pre-filled with a debug byte value that is always greater than 7, rather than random bytes seen on the Mac.
Replies
Boosts
Views
Activity
Jan ’22
Reply to Is there any down side to changing my CFBundleVersion from a 3 part number to a one part number.
It’s actually a good idea. Using dots is sort of a legacy format that still works, except in the case of Xcode 13’s new automatic build number management feature. That feature assumes CFBundleVersion is a simple integer and quietly truncates starting at the first dot. That’s what happened in your previous question. Consider CFBundleVersion as an internal build number. It doesn’t have to resemble your user-visible CFBundleShortVersionString in any way. You can reset it to (say) 1 every time you bump your CFBundleShortVersionString. And if you adopt the automatic build number feature, then you can just leave it alone and let Xcode bump it for you when uploading. Also consider the current documentation for CFBundleVersion to be obsolete. Someone should submit a feedback on that.
Replies
Boosts
Views
Activity
Jan ’22
Reply to NSLocationTemporaryUsageDescriptionDictionary crashes Xcode 13
Bump! This is still broken in Xcode 13.2.1 (13C100). In case anyone else wants to help out by entering a duplicate feedback report. (I’ve already migrated a number of existing projects to auto-generate Info.plist, which is a nice little cleanup. But migrating my last project is blocked due to this bug. Bummer.)
Replies
Boosts
Views
Activity
Jan ’22
Reply to Can NSInputStream.read(_:maxLength:) read less than maxLength even if more is available?
In general, don’t assume anything that isn’t guaranteed in the documentation. It would be perfectly legal for the next OS release to cap the read chunk at a maximum of (say) 42 bytes. If this would break your app logic, then you should program defensively to handle it.
Topic: App & System Services SubTopic: General Tags:
Replies
Boosts
Views
Activity
Jan ’22
Reply to Help with Xcode and curses
It’s something to make certain of us feel old. Or more specifically, “curses is a terminal control library for Unix-like systems, enabling the construction of text user interface (TUI) applications.” I recall trying to make a Hello World type of app using curses on my school’s state-of-the-art green-screen Zenith terminals around 1989, but didn’t yet have the C language skill to make much progress.
Replies
Boosts
Views
Activity
Jan ’22
Reply to URLSession.uploadTask withFile When can file be deleted
Try deleting the file right after you call resume() on the task.
Replies
Boosts
Views
Activity
Dec ’21
Reply to Base64 encoding in JSContext
The atob() function is part of the window object in browser JavaScript, but there is no window object when using JSContext directly. One solution would be to implement the functionality in native code (Swift or Objective-C) and call it from JavaScript. See JSExport (link) and various online tutorials.
Topic: Safari & Web SubTopic: General Tags:
Replies
Boosts
Views
Activity
Dec ’21
Reply to wrong build number shown in AppStore connect
Adding a little to Deepa Pai’s correct answer, your bundle version got “incremented” to 302 because the new auto-managed version logic seems to consider only the first part of a dotted version string. So it considered both your old 301.3.12010 and your new 301.3.13061 to be equivalent to simply 301, therefore duplicate, so it incremented to produce 302.
Replies
Boosts
Views
Activity
Dec ’21
Reply to Permission to bulk operate on other apps
There is no documented API for any of that functionality. That would go way, way, way outside your app sandbox. It seems that 3rd party app management is a thing on Android, but it’s not a thing on iOS.
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Nov ’21