Post

Replies

Boosts

Views

Activity

Xcode 15b4 not allowing TestFlight uploads?
I started building a new app with Xcode 15, and I uploaded a few builds to TestFlight with it. Now I'm trying with 15b4, and I'm getting: Invalid Toolchain. Your app was built with an unsupported SDK or version of Xcode. If you plan to submit this build to the App Store, make sure you are using the versions listed in https://help.apple.com/xcode/mac/current/#/devf16aefe3b or later. (ID: 0c544ce8-53ee-4122-b4a9-467a3d766349) Is this a bug? They've always allowed TestFlight builds with pre-release toolchans, havn't they? How else can you ensure your app is ready for the new OS version if you can't test changes to it?
0
0
527
Jul ’23
Xcode has two kinds of source tabs. What are they?
Have you noticed that Xcode (15 for sure, I think 14 and earlier, too) has at least two kinds of source editor tabs. Some have the filename in regular text, some have it italicized. When the name is italicized, selecting another file in the navigator replaces the contents of that tab with that other file. When the filename is regular, a new tab is opened if you select a different file. When working with multiple related documents, I really dislike, in general, the browser model, wherein a windows contents are replaced by the thing you navigated to. But that's a whole separate rant. For now, I just want to know how and when Xcode decides to make one tab type or the other, and how can I control the behavior?
2
0
1.2k
Jun ’23
App runs fine, but preview complains executeFetchRequest:error: A fetch request must have an entity..
I'm migrating my app from Obj-C to Swift. It uses Core Data, and most of the entities are implemented in Obj-C. I just took a stab at converting one of my views to SwiftUI, and it runs correctly, but Preview crashes with executeFetchRequest:error: A fetch request must have an entity.. I've tried declaring the fetch request both with and without the entity: argument: @FetchRequest(entity: NewsItem.entity(), sortDescriptors: []) var newsItems : FetchedResults<NewsItem>
1
0
661
Jun ’23
Xcode 15b2: Reference to 'Protocol' is ambiguous
I've got some old Objective-C code that up until Xcode 15 was compiling just fine. I recently spent time converting a lot of my project to Swift, which meant putting more stuff in the Bridging Header, but everything was fine. Till today. In file included from /Users/rmann/Projects/Personal/MyApp/repo/src/objc/MissionList/EventListCell.mm:18: In file included from /Users/rmann/Library/Developer/Xcode/DerivedData/MyApp-hkqhwvmmxqyxlkdlbpsbletzgerr/Build/Intermediates.noindex/MyApp.build/Debug-iphonesimulator/MyApp.build/DerivedSources/MyApp-Swift.h:288: In file included from /Users/rmann/Projects/Personal/MyApp/repo/src/BridgingHeader.h:8: /Users/rmann/Projects/Personal/MyApp/repo/src/objc/HessianClasses/CWHessianArchiver.h:52:55: error: reference to 'Protocol' is ambiguous +(void)setClassName:(NSString*)className forProtocol:(Protocol*)aProtocol; ^ note: candidate found by name lookup is 'Protocol' note: candidate found by name lookup is 'Protocol' This is code that uses NSProxy and passes it an Objective-C protocol. The build transcript does not show the locations of the alleged declarations. If I use Shift-Command-O and type "Protocol", I get /Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/objc/Protocol.h, which is unexpected, given that I'm running Xcode 15 beta 2. xcode-select -p gives /Applications/Xcode-beta.app/Contents/Developer. I call this a bug, as it compiles fine in Xcode 14.3, and if it should be an error, it should say why it's ambiguous. FB12434640
2
1
834
Jun ’23
How does SwiftUI decide what default menu items to show on macOS?
I'm trying to write a simple image converter app. I want it to open any image file, and export that image as another type. I started with the multiplatform document app template in Xcode 15b2, and suppressed the New command with .commands { CommandGroup(replacing: CommandGroupPlacement.newItem) {} } I also changed the document readable types: static var readableContentTypes: [UTType] { [.image] } So far, so good. Then I tried modifying the document type declaration to be public.image, and removed the Imported UTI (reasoning that it’s a standard type and shouldn’t need to be redundantly declared, and how can I possibly list all the possible image filename extensions?), but I’m not at all sure I did that right. And somewhere in all that, I noticed that my File menu no longer has an Open command. Does SwiftUI look at the declared document type or imported UTIs to decide what the File menu should look like? UPDATE: Ah, suppressing the New menu also suppressed the Open/Open Recent menu items. That's frustrating.
0
0
484
Jun ’23
Does BGAppRefreshTask get called when your app is foreground or connected to the debugger?
I have yet to see iOS call my background task. I can get it to call it with the debug support (_simulateLaunchForTaskWithIdentifier), but not on its own. Does being foreground suppress the task call? Does being connected to the debugger (but in the background) suppress the call? Does an Xcode-installed app get its background task called? What is the Xcode scheme Run Info option “Launch due to a background fetch event"? Xcode 15b1 and iOS 17b1.
0
0
944
Jun ’23
When importing app with @testable, get “Missing required module 'CTrueTime'” using SPM
I have an old project Objective-C iOS app I've been updating to Swift. It used to use Carthage, but now uses only SPM for dependencies. One such dependency is TrueTime (which was updated to support SPM by that author). It has two products, TrueTime, a Swift library, and CTrueTime a header-only C library with some packed, byte-aligned structs used when parsing NTP responses. I’m adding unit tests to my project, and when I import the app module with @testable import MyApp, the build fails on that line with @testable import MyApp ^ <unknown>:0: error: missing required module 'CTrueTime' The app itself builds and runs just fine. If I don’t import the app, then I have to expressly add code I want to test to the test target, which is not the right way to do these things. The other dependencies I have all work fine, but none have a C library product. I get a warning about implicitly including a bridging header, but I don’t think that has anything to do with this. Update: I also just tried adding TrueTime to a modern, pure SwiftUI iOS app, and I get the same issue. Is there something more I need to add to my test target config? (I've also posted this to stack overflow https://stackoverflow.com/questions/76284838/when-importing-app-with-testable-get-missing-required-module-ctruetime-usi)
0
0
1.2k
May ’23
Preventing macOS from moving my window out of menu bar or notch area?
I have a multi-timezone clock displayed in a very thin window I like to put up on top of my menu bar or in the empty space to the left or right of the notch (when my laptop is not the primary display). There's no issue moving it there, but every time the screens reconfigure, macOS moves my window down out of that area. Is there any way to exempt an NSWindow (or a SwitUI window) from this repositioning behavior?
0
0
509
Apr ’23
Best way to update asynchronous model property in SwiftUI?
I'm working on a SwiftUI client app for my web service. A logged-in user can belong to one or more Organizations, and in the app's settings UI, the user can change which organization is the current selectedOrg. The selected org is displayed using a Picker view in the settings UI. The Model is made available to the UI primarily through @EnvironmentObject. When the user changes the selectedOrg, the app has to fetch some data (a set of Machine records) and set the result in the model. I see at least two ways to do this. A) Use @State in the SwiftUI view, initialized with the current selectedOrg in the model, and .onChange(of:) that state to then call a method that sets the new org and starts the relevant data fetch. B) Bind to the selectedOrg in the model, and use willSet/didSet inside the model to initiate the network request. The latter option feels better, because it pulls a lot of the logic out of the views and into the model/business logic. What are your thoughts on this?
0
0
490
Mar ’23
How do I sign and export a macOS app? Xcode says it can't communicate with Apple
I'm trying to sign and export my macOS app. I do: Archive Distribute App Developer ID -> Export -> Automatically Manage Signing -> FAIL Communication with Apple failed You are not allowed to perform this operation. Please check with one of your Team Admins, or, if you need further assistance, please contact Apple Developer Program Support. https://developer.apple.com/support No profiles for '' were found Xcode couldn't find any Developer ID provisioning profiles matching ''. It should create those for me. I tried to create them via the website, but that ends up making me create a certificate (although it is not clear what kind of certificate). So I do my best to choose the right kind, and then it still doesn't create a profile. I try again, and it says there's no certificate available, so it prompts me to do that again. WHY IS THIS STUFF STILL SO HARD TO DO?
11
0
1.3k
Feb ’23
Running built macOS app in 13.3 beta VM on M1?
I managed to get a macOS 13.3 beta install running in Parallels on my M1 VM, but it was really hard to get my app (built on my 13.2.1 M1 native macOS) installed on it, because so many features are unsupported in the VM (e.g. I can't drop files onto it like I can with other OSes, or on Intel; I can't log in with my Apple ID because Apple doesn't allow that, etc.). I finally copied it over using File Sharing from the VM, but the virtual OS won't launch it. It throws up a vague alert saying "The application can’t be opened." If I try to launch it from the command line, I get The application cannot be opened for an unexpected reason, error=Error Domain=RBSRequestErrorDomain Code=5 "Launch failed." UserInfo={NSLocalizedFailureReason=Launch failed., NSUnderlyingError=0x600000f2da10 {Error Domain=NSPOSIXErrorDomain Code=153 "Unknown error: 153" UserInfo={NSLocalizedDescription=Launchd job spawn failed}}} I assume it's some kind of code signing/gatekeeper issue, but I don't really know. I also tried this using the Apple virtualization framework and sample virtual machine tools (neat that those exist). I'm pretty sure this is exactly what Parallels is using internally, btw. It lacks a LOT. Is there any way to make running macOS betas in a VM a viable way of testing?
4
1
1.2k
Feb ’23
Previewing macOS Settings view?
I'm using Settings to implement the preferences in macOS, with a TabView. Runs fine, but in Xcode preview, it renders the buttons differently. Clearly Settings is applying some kind of button style (or TabView knows it needs to change), but how can I get this to work in a preview? I can't preview Settings directly.
0
0
443
Feb ’23
Customizing option-close Window in SwiftUI?
I have a SwiftUI app made up of two types of window. If I hold the option key while clicking in the close box of one window, it closes all the app windows. I want to change that behavior to just close all the windows of a particular type (or use any other criteria, for that matter). Is this even possible?
0
0
369
Feb ’23