Post not yet marked as solved
We've been looking for a while for a solution to updating package dependencies from the command line. Does Xcode 14 provide a way to do it? I've been searching and haven't seen anything. Anyone saw something?
We've had xcodebuild -resolvePackageDependencies for a while, but as many people point out here and in Stack Overflow, this option does not actually update the dependencies like the Update to Latest Package Versions menu command does in Xcode.
The goal is to have an automated way to keep dependencies up-to-date, so we can run a script nightly that produces a PR which someone on the team can verify before merging.
Hi,
I try to instatiat a ViewController vom a local SPM Package but I always get the error Could not find a storyboard.
let myViewController = UIStoryboard(name: ",yStoryboard", bundle: Bundle(url: Bundle.main.url(forResource: "myModule_myModule", withExtension: "bundle")!)).instantiateViewController(withIdentifier: "MyViewController")
This code works when using it as an remote package. What I'm doing wrong?
Thanks
Bernhard
Post not yet marked as solved
Hi! I am wondering if there is a way to enable resources from a Swift Package to be stored with the ODR system?
I have tried moving my asset catalogs to a Swift Package and while my tags for each asset were intact, the assets disappeared from the "Resource Tags" tab in the Project Settings.
Is there any other way to make them work? I would love to be able to move these asset catalogs to a package to make the project more modular and this is a blocker for me at the moment.
Post not yet marked as solved
Hi,
We are currently using xcframework dependencies in our large project and we've got a compile time of ~15min on CircleCI.
We are trying to move a few dependencies from xcframework to Swift Package Manager but I'm seeing that there is a lot of time being added to our compile time as xcodebuild will always compile spm also.
I've tried caching SourcePackage to limit the download steps but I wasn't able to find a way to cache the spm dependency builds also.
Is this possible ? What is the strategy of compiling large projects with multiple SPM dependencies on a CI system.
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'm trying to log when a user gets a silent notification using didReceiveRemoteNotification. Here is my code right now:
func application(
_ application: UIApplication,
didReceiveRemoteNotification userInfo: [AnyHashable : Any],
fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void
) {
print("Log here")
application.applicationIconBadgeNumber = 0
completionHandler(.noData)
}
Here is the payload.apns file:
"aps" : {
"content-available" : 1,
},
"acme1" : "bar",
"acme2" : 42
If i open Console.app application I can see that the (simulator in this case) wakes up in the background when I drag and drop the payload but it never runs the didReceiveRemoteNotification function.
The app is written in SwiftUI and has a seperate AppDelegate file. The app is also using Firebase Analytics and I have tried to set the FirebaseAppDelegateProxyEnabled to "NO" (false).
Am I doing something wrong?
Note: The function gets called when the app is in the foreground and I drag and drop a normal alert notification (not silent).
Post not yet marked as solved
The session on creating a plugin mentioned that you don’t have access to networking. Is this functionality that may come in a future update, or is there no plan to ever add it? My specific use case is to use a public API my company has available, which provides us a JSON payload so we can generate theme resources. I’d love to be able to put our theming code into a Swift Package, but it sounds like I won’t be able to use a plugin to be able to do the code generation that I need to do.
Command Plugin(s), if available, can be triggered from "File" menu.
Is it possible to define a key binding in Xcode to trigger a command plugin more conveniently? Same is possible for Xcode Extensions today.
For WWDC22 session "Meet Swift Package plugins " the following code snipped is shared in Apple's Developer application:
In Xcode 14 Beta 1 I receive the compilation error Cannot find type 'XcodeBuildToolPlugin' in scope
Is the given example valid and is a struct/type missing in the new library module XcodeProjectPlugin ? Or needs the example code to be adjusted (further then I bug I mentioned below in the comments)?
import PackagePlugin
@main
struct MyPlugin: BuildToolPlugin {?
/// This entry point is called when operating on a Swift package.
func createBuildCommands(context: PluginContext, target: Target) throws -> [Command]
debugPrint(context)
// BUG: needs to return an array !!!!!!!!!!!!!!!!!!!!!!
}
}
#if canImport(XcodeProjectPlugin)
import XcodeProjectPlugin
extension MyPlugin: XcodeBuildToolPlugin {
/// This entry point is called when operating on an Xcode project.
func createBuildCommands(context: XcodePluginContext, target: XcodeTarget) throws -> [Command]
debugPrint(context)
return []
}
}
#endif
Post not yet marked as solved
xcode 13.4 trying move from fat to xcframework.
I create the package by: 'swift package init --type library`;
Move our sources to Source folder;
Generate archive for iOS:
xcodebuild archive -scheme TestFramework \
-destination "generic/platform=iOS" \
-archivePath ./Archive-iOS \
-derivedDataPath ".build" \
SKIP_INSTALL=NO \
BUILD_LIBRARY_FOR_DISTRIBUTION=YES
. Generate archive for iOS Simulator:
xcodebuild archive -scheme TestFramework \
-destination "generic/platform=iOS Simulator" \
-archivePath ./Archive-iOSSimulator \
-derivedDataPath ".build" \
SKIP_INSTALL=NO \
BUILD_LIBRARY_FOR_DISTRIBUTION=YES
Generate the xcframework by docs:
xcodebuild -create-xcframework \
-framework './Archive-iOS.xcarchive/Products/Library/Frameworks/TestFramework.framework' \
-framework './Archive-iOSSimulator.xcarchive/Products/Library/Frameworks/TestFramework.framework' \
-output './Archive-iOS.xcarchive.xcframework'
got error:
error: unable to read the file -> ./Archive-iOS.xcarchive/Products/Library/Frameworks/TestFramework.framework/TestFramework
Ofc, because on steps 3,4 I haven't this framework in archive. Where can I found correct documentation with step by step for make xcframeworks?
Post not yet marked as solved
I'm trying to compile an Xcode project. I'm getting 2 runtime errors:
No such module 'Amplify
&
/Users/????????/Library/Developer/Xcode/DerivedData/screener_app-gkvpndyzdgqrsreqyokgisatdzav/Build/Intermediates.noindex/screener_app.build/Debug-iphonesimulator/screener_app.build/Objects-normal/x86_64/AuthButtonView.dia:1:1: warning: Could not read serialized diagnostics file: error("Invalid diagnostics signature") (in target 'screener_app' from project 'screener_app') Command CompileSwift failed with a nonzero exit code
The screenshot is seen below.
I have tried a handful of things:
cleaned build folder
install/update pods
removedderived data
I'm not sure what to do from here. Any advice is appreciated.
Post not yet marked as solved
failed to read asset tags: The command (cd /Users/Stark/Downloads/hyundai_msrm && /usr/bin/actool --print-asset-tag-combinations --output-format xml1 /Users/Stark/Downloads/hyundai_msrm/hyundai_msrm/Assets.xcassets) exited with status 1. The command's output was:
xcrun: error: invalid active developer path (/Applications/Xcode.app/Contents/Developer), missing xcrun at: /Applications/Xcode.app/Contents/Developer/usr/bin/xcrun
i was wondering that matter if i have older or newest version of xcode ? or is there other error ?
Post not yet marked as solved
We have a Mac app that uses several private GitHub hosted Swift Package Manager packages. The app builds file from within Xcode 13.4 whether the builds are Debug (Run) or Release (Archive).
However, when built via xcodebuild in Terminal, we get Error: No such module [our package] on an import [our package] statement in a Swift source file. I've tried many variants of the xcodebuild archive command, but nothing seems to fix the issue. We have two other nearly identical projects that work fine with the packages and build scripts. The command looks like:
xcodebuild \
-sdk macosx
-target "$target" \
-scheme "$scheme" \
-archivePath "$archivePath" \
-destination "generic/platform=macOS" \
archive
or
xcodebuild \
-scheme "$scheme" \
-archivePath "$archivePath" \
-destination "generic/platform=macOS" \
archive
Again, the app builds fine from within Xcode 100% of the time.
I'm sure we're using the latest tools: xcodebuild -version returns "Xcode 13.4 Build version 13F17a"
I suspect this either has something to do with the Swift packages all referencing a shared package [our package], but I checked the project and Package.swift files and they all use exactly the same name, urls, and capitalization, and the dependencies seem ok, or perhaps it's because we use Schemes to build the apps in three different flavors - dev, qa, and production - all with unique bundleIDs? We're using branch-based .package dependencies if that matters:
.package(name: "OurPackage", url: "https://github.com/account/OurPackage", Package.Dependency.Requirement.branch("main")),
I'd appreciate any suggestions on how to debug/resolve this. I've tried creating a smaller reproducible demo project but of course they all work fine.
Edit: Per a suggestion on iOS-developers, I ran xcodebuild -resolvePackageDependencies and all of the packages downloaded just fine. No errors.
Post not yet marked as solved
finished with error [-1001] Error Domain=NSURLErrorDomain Code=-1001 “The request timed out.” UserInfo={_kCFStreamErrorCodeKey=-2102, NSUnderlyingError=0x282fbd800 {Error Domain=kCFErrorDomainCFNetwork Code=-1001 “(null)” UserInfo={_kCFStreamErrorCodeKey=-2102, _kCFStreamErrorDomainKey=4}}, _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <7060BA29-10BA-40C9-91AB-DCA082E5F038>.<235>, _NSURLErrorRelatedURLSessionTaskErrorKey=(
“LocalDataTask <7060BA29-10BA-40C9-91AB-DCA082E5F038>.<235>”
),NSLocalizedDescription=The request timed out., NSErrorFailingURLStringKey=<xyz.com>, NSErrorFailingURLKey=<xyz.com>, _kCFStreamErrorDomainKey=4}
getting this issue in some rare scenario, unable to find solution for this? anyone can help to resolve this?
because of this issue some times app stucks with loader screen and unable to work further.
I just replaced our server url with <xyz.com>.
I have checked with iPad 3rd generation.
Post not yet marked as solved
I tried everything in this post
It is no effect
https://developer.apple.com/forums/thread/687275
For example,
clean Build folder and remove DerivedData
File -> Packages -> Reset Package Caches
or
File -> Packages -> Update To Latest
even
removed all the embedded frameworks and re-added them
Post not yet marked as solved
OS: macOS 12.3.1 21E258 arm64
Host: MacBookPro18,3
Kernel: 21.4.0
Xcode: 13.3.1 (13E500a)
I used to have the correct flow
new file -> choose file template (Swift File) -> save as (name the file).
Now I have the wrong flow
new file -> choose file template (Swift File)
xcode not show up the save as dialog, just give me File.swift directly.
This problem only happend if I open the swift package directly.
When I do swift package generate-xcodeproj, and open with .xcodeproj. It will work correctly.
Does any one know how to fix this?
Post not yet marked as solved
We are working on an app that manage receiving material and we need to take picture of the material and save it to the network (share drive).
We try all kind of tools Ex. AMSMB2 and we are not able to.
I am sure I am not the only one trying to do that. :)
Thank you for the help
Christian
Post not yet marked as solved
Hey My name is Denvour, I recently completed my final project but can not turn it in due to the fact that I've messed one of my files. One of the files aren't in the folder and I really need to turn this in within the next hour or I'm going to fail my Senior Year. This is the error code below.
"Build input files cannot be found: '/Users/appdev/Desktop/Connect Da'DotsImportant1/Connect Da'Dots/BoardBrown.swift', '/Users/appdev/Desktop/Connect Da'DotsImportant1/Connect Da'Dots/AppDelegate.swift', '/Users/appdev/Desktop/Connect Da'DotsImportant1/Connect Da'Dots/BoardItemBrown.swift', '/Users/appdev/Desktop/Connect Da'DotsImportant1/Connect Da'Dots/Board.swift', '/Users/appdev/Desktop/Connect Da'DotsImportant1/Connect Da'Dots/BoardCellBrown.swift', '/Users/appdev/Desktop/Connect Da'DotsImportant1/Connect Da'Dots/Turn.swift', '/Users/appdev/Desktop/Connect Da'DotsImportant1/Connect Da'Dots/TurnBrown.swift', '/Users/appdev/Desktop/Connect Da'DotsImportant1/Connect Da'Dots/SceneDelegate.swift', '/Users/appdev/Desktop/Connect Da'DotsImportant1/Connect Da'Dots/Brown3.swift', '/Users/appdev/Desktop/Connect Da'DotsImportant1/Connect Da'Dots/BoardItem.swift', '/Users/appdev/Desktop/Connect Da'DotsImportant1/Connect Da'Dots/BoardCell.swift', '/Users/appdev/Desktop/Connect Da'DotsImportant1/Connect Da'Dots/ViewController.swift' (in target 'Connect Da'Dots' from project 'Connect Da'Dots.Important')"
Good day
I am developing XRKit framework, which contains the pipeline logic for rendering using Metal, in manifest it has two targets - framework itself in Swift and XRKitDefenitions in C++ and MSL (since Apple forbids us multilingualism in one package). Both targets have Resources folders open in their manifest.
When I try to access the test files hello01.txt (Resources for XRKit) and hello2.txt (Resources for XRKitDefenitions) via Bundle.module, I only see hello01.txt and it doesn't read hello2.txt because it's in a different target.
How do I properly organize my code with SPM to access the Resources of XRKitDefenitions target?
PS When trying to organize XRKitDefenitions as a remote package on GitHub and defining it as a dependency, situation does not change. I understand now that Bundle.module only refers to its Resources. Is there a way to refer to resources that provided other targets or dependencies in the same package?
Post not yet marked as solved
You can play around with the examples like Sensor arcade.
But where is the function for the mushrooms popup?
How can I create my similar project?