Post

Replies

Boosts

Views

Activity

Code signing issue with SPM Dynamic Library
I have a framework (MyFramework) in which I want to use an existing dynamic framework via SPM (called now MyDynamicFramework). I included it as a package dependency and all seems to be good: Then, I created a test application in which I simply include my framework with Enbed & Sign. When I run this test application, it all works fine in simulator, but in real device I get the following signing-related issue: dyld[24248]: Library not loaded: @rpath/MyDynamicFramework.framework/MyDynamicFramework Referenced from: <ED356026-4AD8-3AD4-9CD7-BE977EE551E4> /private/var/containers/Bundle/Application/432B2A6D-55A7-4C9D-8EA2-622B81E215EA/MyFrameworkTestApp.app/Frameworks/MyFramework.framework/MyFramework Reason: tried: '/private/var/containers/Bundle/Application/432B2A6D-55A7-4C9D-8EA2-622B81E215EA/MyFrameworkTestApp.app/Frameworks/MyDynamicFramework.framework/MyDynamicFramework' (no such file), '/private/var/containers/Bundle/Application/432B2A6D-55A7-4C9D-8EA2-622B81E215EA/MyFrameworkTestApp.app/Frameworks/MyFramework.framework/Frameworks/MyDynamicFramework.framework/MyDynamicFramework' (code signature in <2BD920A5-1906-31B6-99B9-18DE47F02514> '/private/var/containers/Bundle/Application/432B2A6D-55A7-4C9D-8EA2-622B81E215EA/MyFrameworkTestApp.app/Frameworks/MyFramework.framework/Frameworks/MyDynamicFramework.framework/MyDynamicFramework' not valid for use in process: mapped file has no cdhash, completely unsigned? Code has to be at least ad-hoc signed.), '/Users/XXXXXXX/Library/Developer/Xcode/DerivedData/MyFramework-gedzmltwlpgatndvsrwkinsfgwhr/Build/Products/Debug-iphoneos/PackageFrameworks/MyDynamicFramework.framework/MyDynamicFramework' (no such file), ... Am I missing some settings? I thought that Embed & Sign should have solved the issue but it didn't. Thanks. It seems that it works if I embed the MyDynamicFramework in my test application as well, even thought that's already embedded into the framework (MyFramework) that I'm using. I don't see why should I do that, isn't that including the same dynamic framework twice?
0
0
669
Aug ’23
Button's disabled modifier bind to a state is not working in .alert modifier
If I simply have a Button where I have a state variable bind to its .disabled modifier, then it works nice, as expected: struct TestView: View { @State private var saveEnabled: Bool = true var body: some View { Text("Tap me!") .onTapGesture { saveEnabled = !saveEnabled } Button("Save") {} .disabled(!saveEnabled) } } With this code snippet, when the user taps the text, the button is either enabled with blue tint or disabled with greyed out tint. But when I try to do the same within a presented alert, it does not work. My use case is that I present a text field which is prepopulated with a non empty string and then I let the user to change that, but if that's empty, I don't want to let the user to save it, so I want to disable the Button. This concept works fine in UIKit with UIAlertController and UITextField - here I'm not sure why doesn't it work. Code snippet: struct TestView: View { @State private var saveEnabled: Bool = true var body: some View { Text("Tap me!") .onTapGesture { presentAlert = true } .alert("Change name", isPresented: $presentAlert, actions: { TextField("", text: $name) .onChange(of: name) { newValue in saveEnabled = !newValue.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty } Button("Save") {} .disabled(!saveEnabled) } ) } } Should I file a ticket in Feedback Assistant or is there something I'm overlooking? Thanks.
0
0
809
May ’23
Compiler crash with protocol and associated type
The following code results in a segmentation fault and crashes the copmpiler: struct Action {     var intVar: Int     var strVar: String } protocol TestDelegate: AnyObject {     associatedtype ActionType     var actions: [ActionType] { get set } } class TestDelegateImpl: TestDelegate {     typealias ActionType = Action     var actions: [Action] = [] } class TestViewController {     var testDelegate: (any TestDelegate)?     func testFunc() {         testDelegate?.actions.removeAll()     } } let tVC = TestViewController() tVC.testDelegate = TestDelegateImpl() tVC.testFunc() The stack dump: ... 1. Apple Swift version 5.7.1 (swiftlang-5.7.1.135.3 clang-1400.0.29.51) 2. Compiling with the current language version 3. While evaluating request TypeCheckSourceFileRequest(source_file "Contents.swift") 4. While evaluating request TypeCheckFunctionBodyRequest(Contents.(file).TestViewController.testFunc()@Contents.swift:18:10) 5. While type-checking statement at [Contents.swift:18:21 - line:20:5] RangeText="{         testDelegate?.actions.removeAll()     " 6. While type-checking expression at [Contents.swift:19:9 - line:19:41] RangeText="testDelegate?.actions.removeAll(" 7. While type-checking-target starting at Contents.swift:19:31 Stack dump without symbol names (ensure you have llvm-symbolizer in your PATH or set the environment var `LLVM_SYMBOLIZER_PATH` to point to it): 0  swift-frontend           0x00000001078135b0 llvm::sys::PrintStackTrace(llvm::raw_ostream&amp;, int) + 56 1  swift-frontend           0x00000001078125b4 llvm::sys::RunSignalHandlers() + 112 2  swift-frontend           0x0000000107813c34 SignalHandler(int) + 344 3  libsystem_platform.dylib 0x00000001a29542a4 _sigtramp + 56 4  swift-frontend           0x0000000103939b38 (anonymous namespace)::ExprRewriter::coerceToType(swift::Expr*, swift::Type, swift::constraints::ConstraintLocatorBuilder, llvm::Optional&lt;swift::Pattern*&gt;) + 16868 5  swift-frontend           0x00000001039388c8 (anonymous namespace)::ExprRewriter::coerceToType(swift::Expr*, swift::Type, swift::constraints::ConstraintLocatorBuilder, llvm::Optional&lt;swift::Pattern*&gt;) + 12148 6  swift-frontend           0x000000010395c5e8 (anonymous namespace)::ExprRewriter::closeExistential(swift::Expr*&amp;, swift::constraints::ConstraintLocatorBuilder, bool) + 340 7  swift-frontend           0x00000001039547c0 (anonymous namespace)::ExprRewriter::buildMemberRef(swift::Expr*, swift::SourceLoc, swift::constraints::SelectedOverload, swift::DeclNameLoc, swift::constraints::ConstraintLocatorBuilder, swift::constraints::ConstraintLocatorBuilder, bool, swift::AccessSemantics) + 11204 8  swift-frontend           0x0000000103941f50 swift::ASTVisitor&lt;(anonymous namespace)::ExprRewriter, swift::Expr*, void, void, void, void, void&gt;::visit(swift::Expr*) + 8156 9  swift-frontend           0x000000010393cd58 (anonymous namespace)::ExprWalker::walkToExprPost(swift::Expr*) + 24 10 swift-frontend           0x0000000103f944e8 swift::ASTVisitor&lt;(anonymous namespace)::Traversal, swift::Expr*, swift::Stmt*, bool, swift::Pattern*, bool, void&gt;::visit(swift::Expr*) + 268 11 swift-frontend           0x0000000103f94538 swift::ASTVisitor&lt;(anonymous namespace)::Traversal, swift::Expr*, swift::Stmt*, bool, swift::Pattern*, bool, void&gt;::visit(swift::Expr*) + 348 12 swift-frontend           0x0000000103f9445c swift::ASTVisitor&lt;(anonymous namespace)::Traversal, swift::Expr*, swift::Stmt*, bool, swift::Pattern*, bool, void&gt;::visit(swift::Expr*) + 128 13 swift-frontend           0x0000000103932a78 (anonymous namespace)::ExprWalker::rewriteTarget(swift::constraints::SolutionApplicationTarget) + 376 14 swift-frontend           0x00000001039325ec swift::constraints::ConstraintSystem::applySolution(swift::constraints::Solution&amp;, swift::constraints::SolutionApplicationTarget) + 5852 15 swift-frontend           0x0000000103b9a104 swift::TypeChecker::typeCheckTarget(swift::constraints::SolutionApplicationTarget&amp;, swift::OptionSet&lt;swift::TypeCheckExprFlags, unsigned int&gt;) + 688 16 swift-frontend           0x0000000103b99de4 swift::TypeChecker::typeCheckExpression(swift::constraints::SolutionApplicationTarget&amp;, swift::OptionSet&lt;swift::TypeCheckExprFlags, unsigned int&gt;) + 400 17 swift-frontend           0x0000000103c74564 (anonymous namespace)::StmtChecker::typeCheckASTNode(swift::ASTNode&amp;) + 300 18 swift-frontend           0x0000000103c77a64 swift::ASTVisitor&lt;(anonymous namespace)::StmtChecker, void, swift::Stmt*, void, void, void, void&gt;::visit(swift::Stmt*) + 328 19 swift-frontend           0x0000000103c76540 bool (anonymous namespace)::StmtChecker::typeCheckStmt&lt;swift::BraceStmt&gt;(swift::BraceStmt*&amp;) + 300 20 swift-frontend           0x0000000103c7538c swift::TypeCheckFunctionBodyRequest::evaluate(swift::Evaluator&amp;, swift::AbstractFunctionDecl*) const + 1276 21 swift-frontend           0x000000010406ee64 llvm::Expected&lt;swift::TypeCheckFunctionBodyRequest::OutputType&gt; swift::Evaluator::getResultUncached&lt;swift::TypeCheckFunctionBodyRequest&gt;(swift::TypeCheckFunctionBodyRequest const&amp;) + 588 22 swift-frontend           0x0000000104001e64 swift::TypeCheckFunctionBodyRequest::OutputType swift::evaluateOrDefault&lt;swift::TypeCheckFunctionBodyRequest&gt;(swift::Evaluator&amp;, swift::TypeCheckFunctionBodyRequest, swift::TypeCheckFunctionBodyRequest::OutputType) + 116 23 swift-frontend           0x0000000103cb1db0 swift::TypeCheckSourceFileRequest::evaluate(swift::Evaluator&amp;, swift::SourceFile*) const + 792 24 swift-frontend           0x0000000103cb4960 llvm::Expected&lt;swift::TypeCheckSourceFileRequest::OutputType&gt; swift::Evaluator::getResultUncached&lt;swift::TypeCheckSourceFileRequest&gt;(swift::TypeCheckSourceFileRequest const&amp;) + 576 25 swift-frontend           0x0000000103cb1a44 swift::performTypeChecking(swift::SourceFile&amp;) + 120 26 swift-frontend           0x0000000102ed2b8c bool llvm::function_ref&lt;bool (swift::SourceFile&amp;)&gt;::callback_fn&lt;swift::CompilerInstance::performSema()::$_6&gt;(long, swift::SourceFile&amp;) + 16 27 swift-frontend           0x0000000102ecd300 swift::CompilerInstance::forEachFileToTypeCheck(llvm::function_ref&lt;bool (swift::SourceFile&amp;)&gt;) + 288 28 swift-frontend           0x0000000102ecd1a4 swift::CompilerInstance::performSema() + 148 29 swift-frontend           0x0000000102e602ac swift::performFrontend(llvm::ArrayRef&lt;char const*&gt;, char const*, void*, swift::FrontendObserver*) + 4364 30 swift-frontend           0x0000000102e013c0 swift::mainEntry(int, char const**) + 3940 31 dyld                     0x00000001a25fbe50 start + 2544 zsh: segmentation fault  swift Contents.swift Anyone experienced this, or do I overlook somethinig? I would expect this should work, but it seems as it has problems with type checking testDelegate?.actions.removeAll().
5
0
1.6k
Nov ’22