Post

Replies

Boosts

Views

Activity

Reply to How to add Help menu to Maccatalyst App?
I got the same rejection, and I was clueless because there's no menu bar in the storyboard, so I didn't know how to edit it. It turns out you have to do it programmatically. Read Optimizing your iPad App for Mac - https://developer.apple.com/documentation/uikit/mac_catalyst/optimizing_your_ipad_app_for_mac. It says: The Mac version of your app comes with a standard menu bar. Customize it by adding and removing menu items using UIMenuBuilder. There's a sample app in there, but here's are some snippets of the code I wrote. In your AppDelegate class, override the buildMenu function if you want to remove unnecessary menus (my app is a game, so it doesn't need most of the default menus):     #if targetEnvironment(macCatalyst)     override func buildMenu(with builder: UIMenuBuilder) {         if builder.system == .main {             builder.remove(menu: .edit)             builder.remove(menu: .file)             builder.remove(menu: .format)         }     }     #endif The help action, by default, calls a Selector in your App called showHelp. The way I found the name of the selector is by overriding canPerformAction in your main UIViewController and printing out the Selector: override func canPerformAction(_ action: Selector, withSender sender: Any?) -> Bool { 		print(action) 		return true } Anyway, you don't need that unless you are debugging. To override your help action, just add the showHelp selector to you main UIViewController. In this example, I open an external website (I haven't resubmitted my game yet, so I'm not sure opening a website is an accepted method for getting help):     @objc     func showHelp(_ sender: Any?) {         openLocalizedURL("helpURL")     } And as a bonus, here's my openLocalizedURL function: func openLocalizedURL(_ key: String) { 		/* e.g. "http://mywebsite/spanish.html" */     let localized = NSLocalizedString(key, comment: "link to localized URL")     guard let url = URL(string: localized) else {         NSLog("Bad URL: \(localized) (key: \(key))")         return     }     if #available(iOS 10.0, *) {         UIApplication.shared.open(url, options: [:]) { success in             if (!success) {                 NSLog("Failed to open URL: \(localized)")             }         }     } else {         UIApplication.shared.openURL(url)     } } I hope that helps!
Jun ’20
Reply to Mac Catalyst game crashes on GKAchievementInternal showBanner
Thank you. I submitted a feedback with the Feedback Assistant. In the meantime, the only workaround I found is disabling the completion banner in Mac Catalyst:                 #if targetEnvironment(macCatalyst)                 achievement.showsCompletionBanner = false                 #else                 achievement.showsCompletionBanner = true                 #endif And to test the achievements, I used the resetAchievements:         GKAchievement.resetAchievements() { error in             if let error = error {                 NSLog("resetAchievements: \(error.localizedDescription)")             } else if let fn = onCompletion {                 syncAchievements() // function that resubmits all the achievements again             }         }
Jul ’20
Reply to Localization Icon
Create an InfoPlist.strings file in your project, localize that file, and edit the CFBundleDisplayName in each one of the localizations. Read Localizing Property List Values - https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/AboutInformationPropertyListFiles.html
Jul ’20
Reply to How to get real screen size in Mac Catalyst
I verified that nativeBounds and bounds work correctly in macOS 11.0.1. However, the size for sizeRestrictions does not like either of those values. I have a 15-inch MacBook Pro, and for the default Retina display settings I get: nativeBounds: 3360x2100 bounds: 1680x1050 nativeScale: 2 scale: 2 However, if I set the height in sizeRestrictions fixed to 1050, the window is too short. If I set it to 2100, the window is approximately 30% taller than the screen and out of bounds. I read in the UI Guidelines - https://developer.apple.com/design/human-interface-guidelines/ios/overview/mac-catalyst/ that Mac Catalyst apps get scaled 77% down, so a height for approximately 1400 seems to work here. Is there a way to get this scale programatically? At the moment, I hard-coded 1.3 * screen.bounds.height in the code. I'm not 100% that is the correct value for sizeRestrictions though, or if it just happens to be right in this screen.
Nov ’20
Reply to Error while converting MTLTexture to CVPixelBuffer
For environment textures, I don't think it's possible to use that getBytes function. I use the one where you specify the slice: https://developer.apple.com/documentation/metal/mtltexture/1516318-getbytes And I loop like this: for i in 0..<6 {         getBytes(ptr.baseAddress!.advanced(by: i * bytesPerImage), bytesPerRow: bytesPerRow, bytesPerImage: bytesPerImage, from: region, mipmapLevel: 0, slice: i) } I hope that helps.
Dec ’21
Reply to What is the color space of the environment texture of AREnvironmentProbeAnchor?
It looks like the color space is CGColorSpace.linearSRGB. It's an HDR image, according to the paper we found: https://machinelearning.apple.com/research/hdr-environment-map-estimation outputs a completed environment map that is higher dynamic range (HDR, 16 bit channel) I've updated the color space, saved it as PNG, and the output looks fine. I'm assuming when ARKit2 was out, the environment textures were 8-bit at the time, but they've been upgraded since.
Dec ’21
Reply to Disk not ejected properly
I have the same issue with a LaCie Rugged 5TB USB-C HDD, and a Mac mini M1 running macOS Sonoma 14.3. I've done a very long investigation with the Apple Support team and Genius Bar, and with Seagate support chat. My findings so far for my issue, in case it's helpful: Easy way to reproduce: put the computer to sleep and wait 3 minutes. There should be a popup. As someone mentioned, after some days, it may start failing even when working with it. I get a popup every 2 minutes, constant rate. Restarting the Mac fixes this issue (restart in safe mode to restart the NVRAM just in case), and it's back to just failing on sleep. It happens with other Macs, on macOS Sonoma. We tried other Macs in the Genius Bar. It DOES NOT happen when using a USB-C to USB-A cable. It DOES NOT happen when using a 240W thunderbolt charge cable (the £29 cable). It does happen when using the expensive (£75) Thunderbolt 4 data cable (100W according to the specs). I called Apple support again. The engineer explained that when you connect the drive to the computer, there’s a handshake that determines whether to use Thunderbolt, or regular USB-C. Even if the port looks the same, Thunderbolt and USB-C are actually different connections. The Mac must think it’s thunderbolt even if I use a regular USB-C cable. And then it’s when it becomes unstable. When it goes to sleep, it tries to keep a register of the connection so it doesn’t have to do another handshake, or spark a new connection again. Then, when it wakes up it sends data as it was Thunderbolt, when it’s not. That’s the explanation I got and I was suggested to keep using the 240W thunderbolt charge cable. That doesn’t seem to explain why it didn’t work with the Thunderbolt 4 cable, though. However, Seagate asked me to do some speed tests with the different cables. If you are doing this, I recommend using a big file to get consistent results. I zipped my local Movies folder, and that gave me a 1GB ZIP file. To test the copying speed from the Mac mini SSD drive to the external drive, I used rsync. You can use it like this (“LaCie 5TB” is the name of my HDD): rsync -ah --progress ~/Movies.zip /Volumes/LaCie\ 5TB I tried with the Apple cable I got in the Apple store, and with the original LaCie cable: With 240W thunderbolt charge cable: 36.87 Mbytes/sec With USB-C to USB-A adapter cable (for reference): 38.21 Mbytes/sec With USB-C cable from LaCie: 123.62 Mbytes/sec So it’s much slower with the charge cable, as slow as using USB-A 😢 But I can’t reliably use the LaCie cable. Or the £75 Thunderbolt 4 data transfer cable. Seagate says the drive is compatible with both Thunderbolt 4 and USB-C. The Mac Mini M1 port is Thunderbolt 3. Seagate escalated this issue and they told me to wait 24 hours. I will also try to contact Apple again, because I'd really like to use the faster speeds.
Feb ’24