shangjiyu / AnyLink-Secure-Client

OpenConnect compatiable SSL VPN Client
https://github.com/bjdgyc/anylink
5 stars 1 forks source link

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

Open kaes1a opened 1 month ago

kaes1a commented 1 month ago

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 commented 1 month ago

sorry for need some time to polish

kaes1a commented 1 month ago

sorry for need some time to polish

Very much looking forward to it.💪💪💪

shangjiyu commented 3 weeks ago

AnyLinkKit.xcframework.zip

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

kaes1a commented 3 weeks ago

AnyLinkKit.xcframework.zip

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

thx! and i will try it.

kaes1a commented 3 weeks ago

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 commented 2 weeks ago

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.