Post not yet marked as solved
I have a SPM framework project that includes both Swift code and JSON file resources.
With a package file that looks like this:
let package = Package(
name: "MyTestData",
products: [
.library(
name: "MyTestData",
targets: [
"MyTestData",
]
),
],
targets: [
.target(
name: "MyTestData",
dependencies: [],
path: "Sources",
sources: ["ios"],
resources: [
.copy("payloads"),
.copy("snippets"),
]
),
]
)
Now all the SPM packages resolve correctly and the code compiles and works, yet the Xcode workspace is showing errors like this:
Now payloads and snippets are not projects and I've tried all sorts of variations of path, sources, exclude, resource in my Package file and either I get the errors and everything works, or the errors disappear and the project doesn't work. I don't know what the issue is and there's nothing in the resolving or build logs.
Does anyone know what might be the problem here?
Post not yet marked as solved
I work with a number of enterprise clients and one thing we often do is have various frameworks that are optional depending on what type of build we are doing. A common example being to include a framework that contains an embedded server for testing, demo or debugging purposes.
Prior to SPM we would link those frameworks as "Optional" and run a script phase after the build that removed them from the Frameworks directory of the app if it was a "Release" build.
Now I have an Xcode project that includes a number of SPM package, one of which is an embedded server which in turns references several other packages I'd like to exclude form a "Release" build.
But I cannot figure out how to do this. Can I make the inclusion of a package optional? Or somehow remove it after linking?
In Swift I can write #if canImport(MockServer) but I cannot see how to actually make MockServer an optional include.
Any ideas?
Post not yet marked as solved
HI all, just wondering if anyone else has this. I have the iOS16 and I've just noticed that if I try to download an app from the App Store, it just sits there with the circular waiting indicator spinning forever. The download never starts.
Just me or anyone else?
Post not yet marked as solved
Hello everyone. The project I am working on is shifting from using CocoaPods to SPM and there is one "wrinkle" I'd like some advice on. The project has several framework projects containing code as well as the main app project. All of these make use of code generators (RSwift, Sourcery) at some point and these need to be run before the main build starts.
The problem is that SPM builds do not support the concept of adding script phases so there appears to be no easy way to incorporate these shell tools into the builds. Particularly in the framework projects which are pure SPM packages and therefore do not have your typical project files and build phases.
My question is - how to deal with shell based build phases in an SPM world?
Currently we are adding these phases in the main app's build. However they are not run before the builds of the SPM dependencies so effectively we have to run the build twice to ensure the code is up to date.
Post not yet marked as solved
I have a new SwiftUI project I'm working with on my M1Pro. The project is a simple single screen app and I selected new project app when I created it. Selecting to create unit test targets as well.
The app builds and runs. The UI tests build and run successfully.
I then attempted to create a simple unit test and run it. However it's not compiling. The apps module name is "PointsMasterII" and when try to add import PointsMasterII to the unit test, I get the error:
Could not find module 'PointsMasterII' for target 'x86_64-apple-ios-simulator'; found: arm64, arm64-apple-ios-simulator, at: /Users/derekclarkson/Library/Developer/Xcode/DerivedData/PointsMasterII-ahjymfmhybwxvxakiwljcqfzmqea/Index/Build/Products/Debug-iphonesimulator/PointsMasterII.swiftmodule
I also had this is the test class:
func testPoints() {
let calc = Calculator()
}
And when I checked the log of the build I saw
Undefined symbols for architecture arm64:
"type metadata accessor for PointsMasterII.Calculator", referenced from:
Tests_iOS.CalculatorTests.testPoints() -> () in CalculatorTests.o
"PointsMasterII.Calculator.__allocating_init() -> PointsMasterII.Calculator", referenced from:
Tests_iOS.CalculatorTests.testPoints() -> () in CalculatorTests.o
ld: symbol(s) not found for architecture arm64
I don't know how to fix this. I would have expected it to work as the unit test target has the PointsMasterII app as a dependency (setup by Xcode) and the app and UI tests run fine.
Any pointers as to what to look at?
Big Sur is constantly dropping my wifi connection even though I'm less than 10 feet from the router. Sometimes it drops it after only a few seconds, sometimes I can get 20 or 30 seconds and sometimes it shows as connected but I can get any data.
Typically this will go on for 10 or 20 minutes then for some reason it appears to stabilise and stay connected.
It also fails to connect every time I wake the machine.
Anyone else experiencing this?
Post not yet marked as solved
Hello everyone. I'm in an interesting situation where I'm writing a new version of an app from the ground up because the previous (old buggy) app was written using a technology that's out of date and no-one here understands.
Because the app has a local database we want to load into the new app we are keeping the original bundle id. The theory being that the new app overwrite's the old app on a user's device and reads its data.
The problem I have is that it appears that the old app had location updates turned on and was (possibly) consuming battery as a result. In the new app I don't think we need this capability any more and I also want to add the "Background Fetch" or "Background Processing" capability to schedule so local notifications.
My question is can I change the capabilities of an update to an app in the App Store, or am I restricted to the capabilities of the original app?
I created a simple test project in Xcode 11 (on Catalina) and was able to see the previews for the SwiftUI views and their settings etc.I then opened an small established project I have and did all the updates that Xcode 11 suggested to bring it up to spec. Then I added a SwiftUI view using the SwiftUI template. Everything compiles fine, but when I attempt to see the preview of the SwiftUI view I get this error:messageRepliedWithError("Connecting to launched interactive agent 1590",
Optional(Error Domain=com.apple.dt.ultraviolet.service Code=17
"connectToPreviewHost: Failed to connect to 1590: Error Domain=com.apple.dt.ProcessAttachUtilities Code=3
"Target process 1590 exited prematurely, likely crashed"
UserInfo={NSLocalizedDescription=Target process 1590 exited prematurely, likely crashed}"
UserInfo={NSLocalizedDescription=connectToPreviewHost: Failed to connect to 1590:
Error Domain=com.apple.dt.ProcessAttachUtilities Code=3 "Target process 1590 exited prematurely, likely crashed"
UserInfo={NSLocalizedDescription=Target process 1590 exited prematurely, likely crashed}}))I've tried all sorts of things and looked for settings I might have missed but so far I've not been able to figure this out (also rebooted the machine).Anyone happen to come across this and figure it out?