Post

Replies

Boosts

Views

Activity

suddenly 'zsh: killed' my Xcode-based console app
I have a small command-line app I've been using for years to process files. I have it run by an Automator script, so that I can drop files onto it. It stopped working this morning. At first, I could still run the app from the command line, without Automator. But then after I recompiled the app, now I cannot even do that. When I run it, it's saying 'zsh: killed' followed by my app's path. What is that? The app does run if I run it from Xcode. How do I fix this?
3
0
615
Feb ’25
can't open file for writing with FileHandle(forWritingTo: fileURL)
I'm trying to open a file for writing. I can get the URL but the FileHandle always comes back nil. Any idea why this won't work?let fileURL = try FileManager.default.url(for: .documentDirectory, in: .userDomainMask, appropriateFor: nil, create: false).appendingPathComponent("test.tag") let file: FileHandle? = try FileHandle(forWritingTo: fileURL)file always comes back as nil. I get this error:Error Domain=NSCocoaErrorDomain Code=4 "The file “test.tag” doesn’t exist." UserInfo={NSFilePath=/var/mobile/Containers/Data/Application/0D688141-D9C2-4CD0-849F-A2CBC69E34CD/Documents/test.tag, NSUnderlyingError=0x1c465d760 {Error Domain=NSPOSIXErrorDomain Code=2 "No such file or directory"}}Isn't the FileHandle call supposed to create the file? How else do you do it? The only other create file I can find is one that creates a file when you already have the complete contents to provide at the start, and I don't.Thanks!
4
0
7.1k
Mar ’22
NSMenuItem keyEquivalent does not show up
Hello,I am making an NSMenuItem like this:if let mainMenu = NSApplication.shared.mainMenu { if let fileMenuItem = mainMenu.item(withTitle:"File") { if let fileMenu = fileMenuItem.submenu { let export = fileMenu.insertItem(withTitle:"Export", action:#selector(Filer.sharedInstance.Export), keyEquivalent:"e", at:5) export.target = Filer.sharedInstance export.isEnabled = true export.keyEquivalentModifierMask = .command } } }I want it to show the Export command in the menu with "⌘E", but it dossn't. HOWEVER, if I change the "e" to "E" above, then it does show up -- but it wants me to use the shift key as well. That is, the menu looks like this: "Export ⇧⌘E".Is there some reason it won't let me use a lower-case E? I know that the menus always show upper case letters. But I don't want to have to press shift. Just like, for example, the menu for Print shows "⌘P" but you can actually just hit "command-p" to print...Is command-e used for somethng else and that's why it's stopping me?EDIT: Looks like command-E is a Finder shortcut for Eject. Can I override that in my app so that I can use it for export in my menu?Thanks
6
0
2.2k
Mar ’22
Project cannot be opened because it is in a future Xcode project file format
I worked on my project for a while on my laptop, which is running Xcode 13. Now I cannot open it on my High Sierra desktop running XCode 10.1. The alert says to adjust the project format in a compatible version of XCode, but the project format is already XCode 3.2. Why won't it open? It opened fine before I worked on it on the laptop.
1
0
2.1k
Feb ’22
Updating old OpenGLES app - why isn't it fullscreen?
I am updating my old pre-notch OpenGLES app, and when it launches on my iPhone 13, it has black bars at the top and bottom. I was expecting it to fill the screen and go under the notch. Why is it not doing that? When my app starts, I set my view bounds using [[UIScreen mainScreen] bounds], which is giving me dimensions of 375 x 667. The nativeBounds are supposedly 1125 x 2001. But the iPhone 13 is 1170 x 2532 pixels. Why do I get these numbers, where in the app settings is this determined? I can't find anything in the .plist or anywhere else... I've read about safe areas but my app is an old-school EAGLLayer app, no storyboard. I do have a navigationController - but I'm getting this smaller display area being reported before that is even created... I can't find any documentation online about this either. Anyone know?
1
0
1k
Feb ’22
NSURLSession/NSURLConnection POST does not deliver data
I am updating an old app, and my old code which uploads POST messages to a PHP script is not working. It seems like the POST array is simply empty. I've looked online and my code looks just like all the examples I see. just tried the answer given here, a simple example, and I get nothing in the POST array: https://stackoverflow.com/questions/28654603/php-post-script-works-with-other-sites-but-not-with-ios-nsurlconnection Here is the code from that example that does not work for me: @implementation Test : NSObject -(void)userLogin { NSString *user = @"test"; NSString *pass = @"pass"; NSString *post = [NSString stringWithFormat: @"user=%@&pass=%@", user, pass]; NSData *postData = [post dataUsingEncoding:NSASCIIStringEncoding allowLossyConversion:YES]; NSString *postLength = [NSString stringWithFormat:@"%lu", [postData length]]; NSMutableURLRequest *request = [[NSMutableURLRequest alloc] init] ; [request setURL:[NSURL URLWithString:@"www.example.com/login.php"]]; [request setHTTPMethod:@"POST"]; [request setValue:postLength forHTTPHeaderField:@"Content-Length"]; [request setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"Content-Type"]; [request setHTTPBody:postData]; NSURLConnection *conn = [[NSURLConnection alloc] initWithRequest:request delegate:self]; sleep(50); NSLog(@"%@", conn); } @end --------------- PHP file ----------------------- <?php file_put_contents('/tmp/test', print_r($_POST, true)); ?> On the other hand, if I go to a site like this and send a message with a simple 'user=me' and 'pass=whatever', then my php script does show that it received the variables. https://reqbin.com/post-online Furthermore, if I go to a site that will receive POSTs, like this one, then the example code above works fine. http://ptsv2.com Anyone know what could be the issue?
2
0
1.1k
Feb ’22
Xcode: how to see matching brace?
Every IDE I have ever used (besides XCode) has a dead-simple way for you to find the matching brace in a piece of code. You usually select one brace and then the other one is highlighted.XCode does this but only for like 1/100000 of a second, and it does not help when the brace is off the screen, which is the only time you really need this function.Is there a way to do it? I know there used to be that way of folding up the entire scope so that it disappeared, but I always hated that, it was confusing and alarming, and besides I don't even see it anymore.Can somebody please let me know how to do it? I am sure there is a way and I don't see it -- why don't they just do it like everyone else does?
16
3
30k
Jan ’22
Constraints error: Need Constraints for Y Position or height
I am learning to use the constraints system in Xcode, and it is pretty cool. But I am getting some weird errors I don't understand. For example this "View X Needs Constraints for Y Position or Height". This view is within a StackView, which I thought sort of automatically determined its subviews widths and heights. But in order to try to eliminate this error, I added a constraint setting the top to equal the top of the stackview -- that's the same as a Y position, right? And I don't want a static height so I added a Height >= 40 and Height is <= 56 constraint. Shouldn't those all be enough to get rid of the warning? It's still there.
7
0
14k
Nov ’21
suddenly 'zsh: killed' my Xcode-based console app
I have a small command-line app I've been using for years to process files. I have it run by an Automator script, so that I can drop files onto it. It stopped working this morning. At first, I could still run the app from the command line, without Automator. But then after I recompiled the app, now I cannot even do that. When I run it, it's saying 'zsh: killed' followed by my app's path. What is that? The app does run if I run it from Xcode. How do I fix this?
Replies
3
Boosts
0
Views
615
Activity
Feb ’25
how do you get a url that lists all your apps in the App Store?
How does one get a URL like this one, which lists all the apps from this developer? "itms-apps://apps.apple.com/developer/id328077650" What is that ID number? It is not the same as the Team ID. Is that something you have to make, or do all developers have that number?
Replies
1
Boosts
0
Views
712
Activity
Aug ’23
can't open file for writing with FileHandle(forWritingTo: fileURL)
I'm trying to open a file for writing. I can get the URL but the FileHandle always comes back nil. Any idea why this won't work?let fileURL = try FileManager.default.url(for: .documentDirectory, in: .userDomainMask, appropriateFor: nil, create: false).appendingPathComponent("test.tag") let file: FileHandle? = try FileHandle(forWritingTo: fileURL)file always comes back as nil. I get this error:Error Domain=NSCocoaErrorDomain Code=4 "The file “test.tag” doesn’t exist." UserInfo={NSFilePath=/var/mobile/Containers/Data/Application/0D688141-D9C2-4CD0-849F-A2CBC69E34CD/Documents/test.tag, NSUnderlyingError=0x1c465d760 {Error Domain=NSPOSIXErrorDomain Code=2 "No such file or directory"}}Isn't the FileHandle call supposed to create the file? How else do you do it? The only other create file I can find is one that creates a file when you already have the complete contents to provide at the start, and I don't.Thanks!
Replies
4
Boosts
0
Views
7.1k
Activity
Mar ’22
NSMenuItem keyEquivalent does not show up
Hello,I am making an NSMenuItem like this:if let mainMenu = NSApplication.shared.mainMenu { if let fileMenuItem = mainMenu.item(withTitle:"File") { if let fileMenu = fileMenuItem.submenu { let export = fileMenu.insertItem(withTitle:"Export", action:#selector(Filer.sharedInstance.Export), keyEquivalent:"e", at:5) export.target = Filer.sharedInstance export.isEnabled = true export.keyEquivalentModifierMask = .command } } }I want it to show the Export command in the menu with "⌘E", but it dossn't. HOWEVER, if I change the "e" to "E" above, then it does show up -- but it wants me to use the shift key as well. That is, the menu looks like this: "Export ⇧⌘E".Is there some reason it won't let me use a lower-case E? I know that the menus always show upper case letters. But I don't want to have to press shift. Just like, for example, the menu for Print shows "⌘P" but you can actually just hit "command-p" to print...Is command-e used for somethng else and that's why it's stopping me?EDIT: Looks like command-E is a Finder shortcut for Eject. Can I override that in my app so that I can use it for export in my menu?Thanks
Replies
6
Boosts
0
Views
2.2k
Activity
Mar ’22
Project cannot be opened because it is in a future Xcode project file format
I worked on my project for a while on my laptop, which is running Xcode 13. Now I cannot open it on my High Sierra desktop running XCode 10.1. The alert says to adjust the project format in a compatible version of XCode, but the project format is already XCode 3.2. Why won't it open? It opened fine before I worked on it on the laptop.
Replies
1
Boosts
0
Views
2.1k
Activity
Feb ’22
Updating old OpenGLES app - why isn't it fullscreen?
I am updating my old pre-notch OpenGLES app, and when it launches on my iPhone 13, it has black bars at the top and bottom. I was expecting it to fill the screen and go under the notch. Why is it not doing that? When my app starts, I set my view bounds using [[UIScreen mainScreen] bounds], which is giving me dimensions of 375 x 667. The nativeBounds are supposedly 1125 x 2001. But the iPhone 13 is 1170 x 2532 pixels. Why do I get these numbers, where in the app settings is this determined? I can't find anything in the .plist or anywhere else... I've read about safe areas but my app is an old-school EAGLLayer app, no storyboard. I do have a navigationController - but I'm getting this smaller display area being reported before that is even created... I can't find any documentation online about this either. Anyone know?
Replies
1
Boosts
0
Views
1k
Activity
Feb ’22
NSURLSession/NSURLConnection POST does not deliver data
I am updating an old app, and my old code which uploads POST messages to a PHP script is not working. It seems like the POST array is simply empty. I've looked online and my code looks just like all the examples I see. just tried the answer given here, a simple example, and I get nothing in the POST array: https://stackoverflow.com/questions/28654603/php-post-script-works-with-other-sites-but-not-with-ios-nsurlconnection Here is the code from that example that does not work for me: @implementation Test : NSObject -(void)userLogin { NSString *user = @"test"; NSString *pass = @"pass"; NSString *post = [NSString stringWithFormat: @"user=%@&pass=%@", user, pass]; NSData *postData = [post dataUsingEncoding:NSASCIIStringEncoding allowLossyConversion:YES]; NSString *postLength = [NSString stringWithFormat:@"%lu", [postData length]]; NSMutableURLRequest *request = [[NSMutableURLRequest alloc] init] ; [request setURL:[NSURL URLWithString:@"www.example.com/login.php"]]; [request setHTTPMethod:@"POST"]; [request setValue:postLength forHTTPHeaderField:@"Content-Length"]; [request setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"Content-Type"]; [request setHTTPBody:postData]; NSURLConnection *conn = [[NSURLConnection alloc] initWithRequest:request delegate:self]; sleep(50); NSLog(@"%@", conn); } @end --------------- PHP file ----------------------- <?php file_put_contents('/tmp/test', print_r($_POST, true)); ?> On the other hand, if I go to a site like this and send a message with a simple 'user=me' and 'pass=whatever', then my php script does show that it received the variables. https://reqbin.com/post-online Furthermore, if I go to a site that will receive POSTs, like this one, then the example code above works fine. http://ptsv2.com Anyone know what could be the issue?
Replies
2
Boosts
0
Views
1.1k
Activity
Feb ’22
Xcode: how to see matching brace?
Every IDE I have ever used (besides XCode) has a dead-simple way for you to find the matching brace in a piece of code. You usually select one brace and then the other one is highlighted.XCode does this but only for like 1/100000 of a second, and it does not help when the brace is off the screen, which is the only time you really need this function.Is there a way to do it? I know there used to be that way of folding up the entire scope so that it disappeared, but I always hated that, it was confusing and alarming, and besides I don't even see it anymore.Can somebody please let me know how to do it? I am sure there is a way and I don't see it -- why don't they just do it like everyone else does?
Replies
16
Boosts
3
Views
30k
Activity
Jan ’22
When I expire a build does it stop working immediately?
It's not clear to me, when I upload a new beta and it's approved for beta testing, and I expire the older build, does the older build stop working for users who are currently testing it?
Replies
3
Boosts
0
Views
26k
Activity
Jan ’22
Constraints error: Need Constraints for Y Position or height
I am learning to use the constraints system in Xcode, and it is pretty cool. But I am getting some weird errors I don't understand. For example this "View X Needs Constraints for Y Position or Height". This view is within a StackView, which I thought sort of automatically determined its subviews widths and heights. But in order to try to eliminate this error, I added a constraint setting the top to equal the top of the stackview -- that's the same as a Y position, right? And I don't want a static height so I added a Height >= 40 and Height is <= 56 constraint. Shouldn't those all be enough to get rid of the warning? It's still there.
Replies
7
Boosts
0
Views
14k
Activity
Nov ’21