Post

Replies

Boosts

Views

Activity

NavigationSplitView doing weird things
I've got an array of items that I use as a source of truth, and I copy that array into another array (filteredItems) and use that to power a NavigationSplitView (on MacOS). I can sort the items in filteredItems by create date, title, last modified date, forward and reverse, no problem. And I have a text filter field that I can use to filter out items in the filteredItems field and that works great. So far so good. But if I reduce the filter text or remove it altogether—thus increasing the number of items in filteredItems or returning it to its original state—weird things happen. Clicking on items in the navigation portion of the view doesn't bring up the detail view as it did before the reduction and re-adding of items. After clicking on several of the non-responsive nav items, it freezes up. I know there are different ways to do this, but my view is set up like this: NigationSplitView { // filter tool, etc. List { ForEach(ascending ? filteredItems : filteredItems.reversed()) { item in NavigationLink { ItemView(item: item) } label: { // yadda yadda } } } (ascending is just a boolean state variable) I know there's not much detail here, but I should be able to change filteredItems as much as I want, right? Or is this construct wrong?
3
0
158
Oct ’24
How to resolve the "this application is not recognized by Game Center" error
Hi all, I'm working on my first game, and the first step of getting the authenticator view is not working. To simplify the problem, I made a brand new app which only has the following code in the main view controller: import GameKit class ViewController: UIViewController {     override func viewDidLoad() {         super.viewDidLoad()         GKLocalPlayer.local.authenticateHandler = { viewController, error in             NSLog("GameKit authenticating")             if let vc = viewController {                 NSLog("IT WORKED! \(vc.description)")             } else {                 NSLog(error!.localizedDescription)             }         }     } } I've looked through older, similar issues, and so I made sure that I'd done the following: Game center is enabled in the app's Capabilities in Xcode. I've created an app associated with the bundle ID in App Store Connect. In the app's Services tab, I've created two leader boards, one "classic single". Also in Services, I've created one achievement. In the app's "prepare for submission" panel, I've turned on gamecenter, linked the leaderboards, and linked the achievement. For this test app, I have not yet uploaded a build, but I did do so on the actual game app, and and that didn't fix it. And with all that done, in my logs, it looks like this: 2022-01-16 16:28:01.582366-0800 test1ofgamecenter[6863:1006170] [Account Error] startAuthenticationForExistingPrimaryPlayer:Failed to Authenticate player.Error: Error Domain=GKErrorDomain Code=15 "The requested operation could not be completed because this application is not recognized by Game Center." UserInfo={NSLocalizedDescription=The requested operation could not be completed because this application is not recognized by Game Center.} 2022-01-16 16:28:01.976807-0800 test1ofgamecenter[6863:1006170] GameKit authenticating 2022-01-16 16:28:01.976988-0800 test1ofgamecenter[6863:1006170] The requested operation could not be completed because this application is not recognized by Game Center.``` I notice that my achievements and leaderboard are not "live" and I presume that is because I have not submitted the app for review, but I want to get it working before I submit a build that I would expect and want to be rejected. Is there anything else I need to do? Does this configuration require human intervention by Apple staff members? I started this phase of the development Friday evening, so I guess it'd make sense if waiting until Monday would fix it, but that seems weird. Any help? Vital Stats: - M1 Macbook Air - Xcode 13.2.1 (13C100) - Macos Monterey 12.1 - Testing on an iPhone XR and a 2021 iPad Mini, both with the most recent updates of their respective OS's
16
1
6.0k
Jan ’22
Getting Started with Scene Kit
Hi all, I've got an idea for an interesting twist on a 3d aerial battle game, and so I'm taking the plunge on making my first 3d game. I've got the developer docs queued up and the WWDC videos ready to go, and I've bookmarked a Ray Wenderlich tutorial on SceneKit. Before I get started, since this is all so new to me, do any of y'all have any recommendations for good, up-to-date tutorials or hints and tips that might shortcut any of the process? If it helps, my proof of concept will just allow me to have the player chase a computer-controlled airplane around in 3d space, and view that opponent from the cockpit view. I've already done all my homework on the math of movement in 3d space. Had to dust off some trig, and I haven't worked with radians in a long, long time. But the next step is to get some basic visualizations in, and it looks a little daunting. I truly appreciate any guidance you can point towards!!
0
0
1.1k
Oct ’22
Is it possible to check for cellular to get best GPS?
Hi all, I'm working on an app which requires the most accurate AGPS available, so it requires a device with cellular capabilities even if the network is going over wifi, and even if the cellular modem is turned off. The IP-based location services in a non-cellular device (like a wifi-only iPad or an iPod touch just isn't accurate enough for what I'm doing. I know I can put that in the description in the app store, but I'm wondering if there's a way I can account for it in my code, too. Something like the user interface idiom or iOS version checks you can do, but instead specifically isCellularCapable or some such. I just want it to be clear whenever someone fires up the app with an iPod touch or a non-cellular iPad that they're going to have a less-than-ideal experience. I still remember when my kid's friend tried to do Pokemon Go with a non-cellular iPad tethered to my phone, and the device just couldn't figure out where it was supposed to be. I don't want people using my app to have the same experience.
2
0
1.2k
Feb ’22
Xcode beach-balling regularly, don't know what to do.
Hi all, I'm running the latest version of Xcode (12C33) on the latest version of macOS Big Sur 11.1 (20C69) on my new Apple Silicon MacBook Air (16GB, 1TB storage), and while it worked great about a week ago last time I was working on any of my apps, now it beach-balls every couple of minutes for several minutes at a time. There's no apparent error, and it happens with new projects and old projects, regular UIKit apps and SwiftUI apps, ones for just the iPhone and ones that are cross-platform. I've uninstalled everything I could think of that might cause problems, including Chrome and demos of music software (Ableton lite et al) that came with my audio interface, even though Xcode has worked fine since I installed any of those items. I've even uninstalled and re-installed Xcode, but it still happens constantly. I literally can not get anything done and I'm not sure where to look. The only things I have installed since the last time Xcode worked right which I haven't installed are a couple of Apple Arcade games, but I might do those as well. It happens when there are no other apps running, but when it's happening if I run Terminal the load is low, and if I use Activity monitor, there's literally nothing going crazy on any of the eight cores. Not a lot of reads/writes, nor a lot of data moving up and down the pipe. It just seizes up, and then eventually does whatever I asked it to, but a 2-10 minute pause every time I edit half a line of code, or longer if I build the app and deploy it to my phone or a simulator just doesn't work for me. Any ideas? The last time Xcode ran well for me, realize as I write this, was when I tried out a basic hello-world watch app. It displayed great in the swiftui console, but I couldn't get it to deploy to my watch, so eventually gave up. Is it possible this left some cruft in the system that I need to clean out? HELP!! (please)
9
0
2.2k
Jan ’21
Trying to create a share extension to get input from Safari
Hi All,I'm working on a custom bookmarking/website diary app which will allow manual input of URLs, but for which I'd like to be able to allow users to do a share action from Safari in order to invoke the app.I've deployed my first share extension, and in my 'didSelectPost' function, I'm trying to examine the info that comes in, and I'm able to see everything but the comments typed into the share form.Here's the code I'm using: override func didSelectPost() { for item in self.extensionContext!.inputItems { if let item = item as? NSExtensionItem { if let x = item.attributedContentText { NSLog("x = \(x)") } let attachments = item.attachments! NSLog("Item: \(item)") let provider = attachments.first! NSLog("PROVIDER \(provider)") if provider.hasItemConformingToTypeIdentifier("public.url"){ provider.loadItem(forTypeIdentifier: "public.url", options: nil, completionHandler: { (attachment, error) in if let url = attachment as? URL{ let link = try! String(contentsOf: url, encoding: .utf8) NSLog("URL: \(url)") // GOT MY URL! NSLog("link: \(link)") // GOT THE CONTENTS OF THE URL } }) } } } self.extensionContext!.completeRequest(returningItems: [], completionHandler: nil) }My question is, where do I look to see what the user typed in the share sheet? Every tutorial I've found on this seems to go into great detail on how to share an image, but I seem to be missing the piece about grabbing the user-generated content.
0
0
906
May ’20