Today the Connect page asks me to confirm if I am a trader or not under DSA.
I am an independent developer and have several apps in App Store. I have no idea what a trader is.
The DSA defines a trader as “any natural person, or any legal person irrespective of whether privately or publicly owned, who is acting, including through any person acting in his or her name or on his or her behalf, for purposes relating to his or her trade, business, craft or profession.” If you have questions about your status as a trader, consult with your legal advisor.
I emailed Connect support but their reply is very "official" which confuses me more.
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
The following code won't work:
- (void)windowDidLoad {
[super windowDidLoad];
self.window.isVisible = NO;
}
The only main window still shows on application startup (in a minimal newly created app).
One of my published apps in App Store relies on this behavior which had been working for many years since I started Xcode development.
Topic:
UI Frameworks
SubTopic:
AppKit
Dare anyone try the following code in any Playground:
// Define a model that conforms to Codable
struct User: Codable {
var name: String
var age: Int
var email: String?
}
// JSON data (as a string for demonstration)
let jsonString = """
{
"name": "John Doe",
"age": 30,
"email": "john@example.com"
}
"""
// Convert the JSON string to Data
if let jsonData = jsonString.data(using: .utf8) {
do {
// Parse the JSON data into the User model
let user = try JSONDecoder().decode(User.self, from: jsonData)
print("Name: \(user.name), Age: \(user.age), Email: \(user.email ?? "N/A")")
} catch {
print("Error decoding JSON: \(error)")
}
}
I tested with Xcode 16.2 and latest 16.3, it reliably crashes the lldb server!
I am trying to add rows to GridView and not able to get expected row height correctly.
override func viewDidLoad() {
super.viewDidLoad()
// Remove the row in IB designer
gridView.removeRow(at: 0)
let image = NSImage(named: NSImage.colorPanelName)!
//image.size = NSMakeSize(80, 80)
let imageView = NSImageView(image: image)
imageView.imageFrameStyle = .grayBezel
imageView.imageScaling = .scaleAxesIndependently
imageView.frame = NSMakeRect(0, 0, 80, 80)
let label = NSTextField(labelWithString: "test text")
let row = gridView.addRow(with: [imageView, label])
row.height = 80
}
What was wrong with my code?
I have a need to read first half and second half of a file concurrently. Is there any best practices for this scenario?
BTW, I did research on DispatchIO but it turned out DispatchIO is all about asynchronous operations on a single file handle; it cannot perform parallel reading.
// naive approach
Task {
fileHandle.read(into:buffer)
}
Task {
// seek to file size / 2
fileHandle.read(into:buffer)
}
I want to use NSTask to run a shell script that resides in Resouces directory. The script performs some operations on files in the app's Data directory.But I am concerned that Apple could refuse my app for some reasons. Can anyone confirm if this approach is safe. Thanks.
I have the following code:@implementation NSWindow (Coordination)
- (NSPoint)convertPointFromScreen:(NSPoint)point
{
NSRect rect = NSMakeRect(point.x, point.y, 1, 1);
return [self convertRectFromScreen:rect].origin;
}I get a compiliation warning:Category is implementing a method which will also be implemented by its primary classI know Swift has builtin preprocessor directives to detect SDK version, but don't know how to do this in objc. Any suggestions?
I am currently using Xcode 14.2 (14C18), but it has some glitches (which I don't want to enumerate here).
I now want to revert back to an earlier older version. Any suggestions?
I cannot find any docs on this image name but I can select it from the dropdown list in IB. What is the mim macOS version for this name?
I have a single-line label whose purpose is display file path, possibly very long.
Is there any way to shorten/compact the path string (with ellipse ...) so that the label still displays full path even it's too long?
Like below:
/some/very/long/path/to/some/filename.txt
to
/some/.../filename.txt
What unit does NSView.bounds/frame use? Pixel or point? How to convert between them?
I get many warnings like this when I build an old project.
I asked AI chatbot which gave me several solutions, the recommended one is:
var hashBag = [String: Int]()
func updateHashBag() async {
var tempHashBag = hashBag // make copy
await withTaskGroup(of: Void.self) { group in
group.addTask {
tempHashBag["key1"] = 1
}
group.addTask {
tempHashBag["key2"] = 2
}
}
hashBag = tempHashBag // copy back?
}
My understanding is that in the task group, the concurrency engine ensures synchronized modifications on the temp copy in multiple tasks. I should not worry about this.
My question is about performance.
What if I want to put a lot of data into the bag? Does the compiler do some kind of magics to optimize low level memory allocations? For example, the temp copy actually is not a real copy, it is a special reference to the original hash bag; it is only grammar glue that I am modifying the copy.
I have a need to tell if 2 images are different by unimportant details.
For example, one image is only slightly different than another because:
*) It is a little stretched
*) or it has 99% portion of another (only missing some pixels on borders)
I wonder if there is an efficient algorithm to achieve my goal. Any suggestions are welcome.
In IB I connect a button to a VC and set the segue kind to 'Popover'. Now I have a problem. How do I get the NSPopover and its delegate?
-(void)prepareForSegue:(NSStoryboardSegue *)segue sender:(id)sender {
NSLog(@"%s: %@", __func__, segue.destinationController);
NSViewController* vc = segue.destinationController;
}
I want to add "Show in Finder" in my app that is similar to the one in Xcode. How do I do this using objc?