From 3ea37d6c1f21eed8254715d104ec3cf821a13d39 Mon Sep 17 00:00:00 2001 From: Linus Gasser Date: Fri, 14 May 2021 09:01:41 +0200 Subject: [PATCH] Thanks @Pleurinae for pointing out it's a static library... And it needs to be included somewhere in a call. --- ios/Runner.xcodeproj/project.pbxproj | 12 ++++++------ ios/Runner/AppDelegate.swift | 6 ++++++ lib/cwtch/ffi.dart | 2 +- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index 82584dab..58b0aeda 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -14,8 +14,8 @@ 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; - F46DFE5C26487EE800B3B0AF /* cwtch.a in Frameworks */ = {isa = PBXBuildFile; fileRef = F46DFE5B26487EE800B3B0AF /* cwtch.a */; }; - F46DFE5D26487EF000B3B0AF /* cwtch.a in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = F46DFE5B26487EE800B3B0AF /* cwtch.a */; }; + F40D366C264E52D500E39EB5 /* cwtch.a in Frameworks */ = {isa = PBXBuildFile; fileRef = F40D366B264E52D500E39EB5 /* cwtch.a */; }; + F40D366D264E52E000E39EB5 /* cwtch.a in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = F40D366B264E52D500E39EB5 /* cwtch.a */; }; /* End PBXBuildFile section */ /* Begin PBXCopyFilesBuildPhase section */ @@ -25,7 +25,7 @@ dstPath = ""; dstSubfolderSpec = 10; files = ( - F46DFE5D26487EF000B3B0AF /* cwtch.a in Embed Frameworks */, + F40D366D264E52E000E39EB5 /* cwtch.a in Embed Frameworks */, ); name = "Embed Frameworks"; runOnlyForDeploymentPostprocessing = 0; @@ -50,9 +50,9 @@ 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + F40D366B264E52D500E39EB5 /* cwtch.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = cwtch.a; path = "../libcwtch-go/ios/cwtch.a"; sourceTree = ""; }; F46DFE4E2648741800B3B0AF /* x86_64.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = x86_64.a; path = "../../libcwtch-go/ios/x86_64.a"; sourceTree = ""; }; F46DFE552648764D00B3B0AF /* cwtch.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = cwtch.h; path = "../../../libcwtch-go/ios/cwtch.h"; sourceTree = ""; }; - F46DFE5B26487EE800B3B0AF /* cwtch.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = cwtch.a; path = "../../libcwtch-go/ios/cwtch.a"; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -61,7 +61,7 @@ buildActionMask = 2147483647; files = ( 57A4E41C4075DFE2289DBB05 /* Pods_Runner.framework in Frameworks */, - F46DFE5C26487EE800B3B0AF /* cwtch.a in Frameworks */, + F40D366C264E52D500E39EB5 /* cwtch.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -92,7 +92,7 @@ 97C146E51CF9000F007C117D = { isa = PBXGroup; children = ( - F46DFE5B26487EE800B3B0AF /* cwtch.a */, + F40D366B264E52D500E39EB5 /* cwtch.a */, 9740EEB11CF90186004384FC /* Flutter */, 97C146F01CF9000F007C117D /* Runner */, 97C146EF1CF9000F007C117D /* Products */, diff --git a/ios/Runner/AppDelegate.swift b/ios/Runner/AppDelegate.swift index 70693e4a..48ff83d3 100644 --- a/ios/Runner/AppDelegate.swift +++ b/ios/Runner/AppDelegate.swift @@ -10,4 +10,10 @@ import Flutter GeneratedPluginRegistrant.register(with: self) return super.application(application, didFinishLaunchingWithOptions: launchOptions) } + + // this is never called, but otherwise Xcode will optimize away the cwtch.a library + // and not include it in the final binary... + public func dummyMethod(){ + c_ACNEvents() + } } diff --git a/lib/cwtch/ffi.dart b/lib/cwtch/ffi.dart index f5758b3b..5ccbb65b 100644 --- a/lib/cwtch/ffi.dart +++ b/lib/cwtch/ffi.dart @@ -76,7 +76,7 @@ class CwtchFfi implements Cwtch { } else if (Platform.isLinux) { library = DynamicLibrary.open("libCwtch.so"); } else if (Platform.isIOS) { - library = DynamicLibrary.open("cwtch.a"); + library = DynamicLibrary.process(); } else { print("OS ${Platform.operatingSystem} not supported by cwtch/ffi"); // emergency, ideally the app stays on splash and just posts the error till user closes