Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

missing depens 'AnyLinkKit' when flutter run for iOS #1

Open
kaes1a opened this issue Oct 23, 2024 · 6 comments
Open

missing depens 'AnyLinkKit' when flutter run for iOS #1

kaes1a opened this issue Oct 23, 2024 · 6 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@kaes1a
Copy link

kaes1a commented Oct 23, 2024

hello
when i try to compile and run for iOS, found issue 'AnyLinkKit' is missing.
so i open the Runner.xcworkspace i found '../../sslcon/AnyLink-apple' those keyword
image

i hope to the ‘sslcon for apple(AnylinkKit)’ can be release source project or binary

thanks

@shangjiyu
Copy link
Owner

sorry for need some time to polish

@shangjiyu shangjiyu added the enhancement New feature or request label Oct 23, 2024
@kaes1a
Copy link
Author

kaes1a commented Oct 23, 2024

sorry for need some time to polish

Very much looking forward to it.💪💪💪

@shangjiyu
Copy link
Owner

AnyLinkKit.xcframework.zip

I'm not so familiar with xcode development and try it your self

@kaes1a
Copy link
Author

kaes1a commented Oct 30, 2024

AnyLinkKit.xcframework.zip

I'm not so familiar with xcode development and try it your self

thx! and i will try it.

@kaes1a
Copy link
Author

kaes1a commented Oct 30, 2024

when i import this framework into the Runner and ZeroQTunneliOS target, it's not work. and i check the framework, It should be a missing header file and declaration file. like modulemap file etc.
So. the issue is 'No such module 'AnyLinkKit''
image

@shangjiyu
Copy link
Owner

shangjiyu commented Nov 2, 2024

Copied from OpenAI:

To create an XCFramework in Swift, you can use the Swift Package Manager (SPM) to build and manage your package, then follow these steps to create the XCFramework. XCFrameworks are useful for supporting multiple platforms and architectures in a single package, which is ideal for distributing libraries.

Steps to Create an XCFramework

  1. Define Your Swift Package:
    Create a Package.swift file for your library. Define targets for different platforms if needed.

    // swift-tools-version:5.3
    import PackageDescription
    
    let package = Package(
        name: "YourLibrary",
        platforms: [.iOS(.v13), .macOS(.v10_15)],
        products: [
            .library(
                name: "YourLibrary",
                targets: ["YourLibrary"]),
        ],
        targets: [
            .target(
                name: "YourLibrary",
                path: "Sources"
            ),
        ]
    )
  2. Build the Frameworks:
    Use xcodebuild commands to compile the library for each required platform (e.g., iOS and macOS). Run these commands from the root directory of your Swift package:

    # Build for iOS
    xcodebuild archive \
      -scheme YourLibrary \
      -destination "generic/platform=iOS" \
      -archivePath ./build/ios.xcarchive \
      -sdk iphoneos \
      SKIP_INSTALL=NO BUILD_LIBRARY_FOR_DISTRIBUTION=YES
    
    # Build for iOS Simulator
    xcodebuild archive \
      -scheme YourLibrary \
      -destination "generic/platform=iOS Simulator" \
      -archivePath ./build/ios-simulator.xcarchive \
      -sdk iphonesimulator \
      SKIP_INSTALL=NO BUILD_LIBRARY_FOR_DISTRIBUTION=YES
    
    # (Optional) Build for macOS
    xcodebuild archive \
      -scheme YourLibrary \
      -destination "platform=macOS" \
      -archivePath ./build/macos.xcarchive \
      SKIP_INSTALL=NO BUILD_LIBRARY_FOR_DISTRIBUTION=YES
  3. Create the XCFramework:
    After building the archives, you can create the XCFramework by combining the archives with the following command:

    xcodebuild -create-xcframework \
      -framework ./build/ios.xcarchive/Products/Library/Frameworks/YourLibrary.framework \
      -framework ./build/ios-simulator.xcarchive/Products/Library/Frameworks/YourLibrary.framework \
      -framework ./build/macos.xcarchive/Products/Library/Frameworks/YourLibrary.framework \
      -output ./YourLibrary.xcframework
  4. Distribute the XCFramework:
    You can distribute the .xcframework by archiving it into a .zip file, or by publishing it as a binary target in Swift Package Manager.

Using the XCFramework in Swift Package Manager

To distribute the XCFramework via SPM, update your Package.swift with a binary target:

let package = Package(
    name: "YourLibrary",
    platforms: [.iOS(.v13), .macOS(.v10_15)],
    products: [
        .library(name: "YourLibrary", targets: ["YourLibrary"]),
    ],
    targets: [
        .binaryTarget(
            name: "YourLibrary",
            path: "./YourLibrary.xcframework"
        ),
    ]
)

Now, developers can add your package to their projects as an XCFramework-based dependency. This approach ensures compatibility across different platforms and architectures.

@shangjiyu shangjiyu added the help wanted Extra attention is needed label Nov 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
Status: In Progress
Development

No branches or pull requests

2 participants