Take a look at this project. It gives you a way to inpsect the view hierarchy. Look at the test cases for plenty of examples.https://github.com/nalexn/ViewInspector
Post
Replies
Boosts
Views
Activity
My code is a little older, but the principles should be the same. Here's how I created an NSManagedObjectModel:
lazy var managedObjectModel: NSManagedObjectModel = {
// The managed object model for the application. This property is not optional.
// It is a fatal error for the application not to be able to find and load its model.
let bundle = Bundle.module
let modelURL = bundle.url(forResource: self.managedModelRootName, withExtension: self.managedModelExtension)!
return NSManagedObjectModel(contentsOf: modelURL)!
}()
The key is I had to find the reference to it myself using the bundle that contains the module. To find the bundle I used Bundle.module which may be new to things this year. I found out about it from Insert link text here - https://developer.apple.com/wwdc20/10169.
For your code, which looks like it is based off of newer template code, you'll have to find the proper load point. The key is to use the right bundle, though.
I just looked at it. Bundle.main is generated. It essentially boils down to Bundle(for: BundleFinder.self) where BundleFinder.self is the name of the generated file. That's really close to what I had in there before all this. It looks for the resources in three places so you have flexibility on where to put your resources:
let candidates = [
// Bundle should be present here when the package is linked into an App.
Bundle.main.resourceURL,
// Bundle should be present here when the package is linked into a framework.
Bundle(for: BundleFinder.self).resourceURL,
// For command-line tools.
Bundle.main.bundleURL,
]
With beta 6 my package previews stopped with "Could not find host for previews", very annoying. I created a sample project using that template with a view that just has a text field in it, and that will only work if the testTarget part of Package.swift is commented out. If that is in there then Xcode won't build the test target with the proper architecture.
With Xcode 12b6 the previews will only work if there is exactly one product and one target for that product. Test targets give link errors, another block in those sections cause failure. Any more targets, even if unused, cause failures in finding the host for the preview.
Well. Bizarre about the external monitor thing. For all of you having this, do you also see an empty Components tab which prevents you from downloading simulators?
Disheartening that these tools present us with another insurmountable error. For me it's only with an M1 MacBook Pro and trying to run unit tests on a Framework. For me, I get: Underlying Error: Invalid device state.
More on that post-integration trigger. Without the direct clone I noticed that the directory has a partially cloned repository in it. Seems to have either given up part way through the clone or was shutoff by GitHub partially through.
Here's the source control log:
Jun 24 23:41:34 [26422] : Will attempt to update checkout cache for bot
Jun 24 23:41:34 [26422] : Xcode Source Control Blueprint was valid.
Jun 24 23:41:34 [26422] : About to update/checkout:
https://github.com/endresjd/NewListFeatures (null) into (null)
Jun 24 23:41:34 [26422] : Could not load cached workspace: Error Domain=XCSIntegrationService Code=2 "The repositories have changed since the last integration. Falling back to a clean checkout." UserInfo={NSLocalizedDescription=The repositories have changed since the last integration. Falling back to a clean checkout.}
Jun 24 23:41:34 [26422] : An error occurred updating existing checkout: Error Domain=XCSIntegrationService Code=2 "The repositories have changed since the last integration. Falling back to a clean checkout." UserInfo={NSLocalizedDescription=The repositories have changed since the last integration. Falling back to a clean checkout.}
Jun 24 23:41:35 [26422] : 10.00% Compressing objects: 100% done
Jun 24 23:41:35 [26422] : Error occurred loading revisioned blueprint from workspace: Error Domain=com.apple.dt.SourceControlErrorDomain Code=-300 "The remote repository could not be accessed." UserInfo={com.apple.dt.sourcecontrol.UnderlyingErrorString=, NSLocalizedDescription=The remote repository could not be accessed., NSLocalizedRecoverySuggestion=Make sure a valid repository exists at the specified location and that the correct credentials have been supplied.}
Sorry about the formatting. It insists on removing any line endings. #sigh. Just no quality in things anymore.
It was a bug in Xcode that surfaced in the next beta's release notes. Beta 3 got around this problem, but bots still never finish for random reasons.
I wondering how you run the fix-permissions scripts from a bot. So far Xcode Server is having a 100% failure rate for me. Different errors at different times. Gotta say I love the 1" maximum feedback area in the bot results too. Best you can do is make it smaller. So much vertical whitespace. It's like being on Stack Overflow and having to constantly scroll left and right to read something while you see huge margins on the left and right. I'm thinking that that alone shows the amount of love this isn't getting, so I'm going to give up on it.
There's a "Rebuild..." button. The "..." used to mean it will ask for more info, so I was thinking that might help. Instead it just started a new build without asking anything.
I wonder if setting CI_BUILD_NUMBER in the Environment section can bump it up?
FWIW, I’m using an Intel Mac and it’s failing. Thanks @danlloydjones for a workaround.
The actual error I get from App Store Connect is not permitted. 🙄
Me too, but a simple app using Swift Playgrounds on iPad. I sent a message to support about this describing what I was doing, and a copy of the error and got the response: “We're unable to determine the nature of your request. Please reply to this email with clarification”.
This was the error I get back in email:
ITMS-90334: Invalid Code Signature Identifier - The identifier 'Johnboxgame-numbers_and_letters_that_forums_thinks_are_offensive' in your code signature for 'Johnboxgame' must match its Bundle Identifier 'Johnboxgame'
WIth the iPad app there’s not really much I can control as far as what goes in the bundle, and it’s worked in the past.