Post

Replies

Boosts

Views

Activity

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
903
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
857
Feb ’22
XCode project will not run
I tried to open and run an old project for the first time in a few months today. At first it would not compile - it said something about invalid certificates I think? I opened Preferences and it wanted me to log in again. That must have updated my certificates because now it compiles. But when I try to run, it just immediately quits. It says 'finished' in the top window. In the console it says Message from debugger: unable to attach. I feel like it's probably some kind of certificate/provisioning issue, but I can't find any place where it lists an error. Anyone know what the problem could be? I am running Xcode 10.1 on High Sierra. Maybe things are too old, but the same setup ran fine a few months ago and I haven't changed anything. Thanks
2
0
748
Mar ’21
Where to ask Metal programming question?
Do these forums not have categories? I have a question about using Metal's RenderPassDescriptor colorAttachments. If I set up three color attachments in the renderDescriptor, is it necessary for the Pipeline Descriptors to support those three attachments? In other words? Can some pipelines use only 2 of the attachments and ignore the 3rd? I added a 3rd attachment for one particular shader, but I don't want to use it at other times. But I am getting an error from one of the pipelines that doesn't reference it: pixelFormat (MTLPixelFormatInvalid) does not match the framebuffer's pixelFormat (MTLPixelFormatBGRA8Unorm).'
1
0
552
Jun ’20
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
2k
Jun ’18
simple sounds will not play
I'm trying to play some simple interface sound effects, and the method I found online does not work. I don't get any errors but the sounds just don't play. My phone is not on silent mode, the volume is all the way up.if let soundUrl = Bundle.main.url(forResource: filename, withExtension: ext) { var soundId: SystemSoundID = 0 AudioServicesCreateSystemSoundID(soundUrl as CFURL, &soundId) AudioServicesPlaySystemSoundWithCompletion(soundId, { AudioServicesDisposeSystemSoundID(soundId); }); }I also tried adding this but it did not help:AVAudioSession.sharedInstance().setCategory(AVAudioSessionCategoryPlayback)Any ideas?
7
0
6.0k
Sep ’17
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
6.3k
Aug ’17
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
Aug ’17
determine Siri remote landscape/portrait?
The docs talk about the 'allowsRotation' property of GCMicroGamepad -- it allows the remote to be used in landscape orientation as well as portrait, supposedly.I tried setting this to YES, but it doesn't seem to affect the dpad values. Has anyone gotten it to work?Also, if I'm tracking touches and using the gravity values in addition to the dpad, that property isn't going to help me anyway, is it? So does anyone know if there's a good way to decide when the remote's in portrait vs when it is landscape? There's not any API for determining that, is there?ThanksBob
1
0
844
Oct ’15
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?
14
3
27k
Sep ’15