Closed InfiniteCode closed 6 years ago
@InfiniteCode check if you have latest version of NuGet. I will check what's going on with this specific cocoapod.
I do have the latest. What is surprising, running any of the pods - lottie-ios, or any other one results in the same half-finished script. Seems like dependency graph is not populated, so it never iterates through the list.
RichEditorView is a swift-based pod. I did not plan to support that initially.
Because of that generating C# code and getting binary fails with error
[!] Pods written in Swift can only be integrated as frameworks; add 'use_frameworks!' to your Podfile or target to opt into using it. The Swift Pod being used is: RichEditorView
Checking what we can do there, will update in a while
@InfiniteCode would you be kind as to run sh bind.sh POD=lottie-ios VERBOSE
and send a link to gist with the logs or attach a log file here?
I am still checking if there is a way to make objc-automatic to work with swift-based cocoapods
Hey. So there are couple minor problems with Swift frameworks in cocoapods and also with this specific RichEditView pod.
objc-automatic
to make it at least generate the binding project.objective sharpie
is trying to infer the C# api based on Objc headers for Swift framework it gets many things incorrectly because Objc headers for Swift are not exactly same as for just normal Objc-based pod. That's fine, you can figure it out.
Basically, one has to remove initWithCoder
bindings and update Delegate properties and comment WeakDelegate properties. And that is all, binding is generated and packaged into the nupkg.
Would be great if you can check this package and see if it works for you. Meanwhile I can update the objc-automatic
so everyone can follow the process.
Glad that you brought up this issue @InfiniteCode. That is actually a first example of making Xamarin binding to Swift library. With updated objc-automatic, it will be easy.
Package zip attached:
Hey, do you still need me to run that script with VERBOSE logging? I could probably do it today in the evening. And thanks so much for pre-baked bindings!
Unfortuntely, when tried to build with the provided binding it failed at linking phase. It was also strange that after added a Nuget package, I had to manually go to the project and pick the DLL. Otherwise, it wouldn't see the namespace and classes:
/Users/username1/Projects/iOS/MTOUCH: Error MT5209: Native linking error: file not found: /Users/username1/Projects/iOS/obj/iPhoneSimulator/Debug/mtouch-cache/RichEditorView.a (MT5209) (iOS)
Is there something else that is needed for binding to work? (Or maybe it wasn't built for Simulator)
@alexsorokoletov Here is the Verbose output:
username1$ sh bind.sh POD=lottie-ios VERBOSE Checking Paket version (downloading latest stable)... Paket.exe 4.0.7 is up to date. Paket version 4.0.7 Skipping resolver for group Auto since it is already up-to-date Skipping resolver for group Main since it is already up-to-date /Users/username1/Projects/objc-automatic/paket.lock is already up-to-date 2 seconds - ready. Building project with version: LocalBuild Shortened DependencyGraph for Target Bind: <== Bind
The resulting target order is:
- Bind Starting Target: Bind VERBOSE IS true List of pods: ["lottie-ios"] Sorted dependency graph: ["lottie-ios"] /Users/username1/Projects/objc-automatic/pods/lottie_ios/XCode does not exist. Creating /Users/username1/Projects/objc-automatic/pods/lottie_ios/XCode /Users/username1/Projects/objc-automatic/pods/lottie_ios/XCode already exists. pod install Analyzing dependencies Downloading dependencies Installing lottie-ios (1.5.1) Generating Pods project Integrating client project
[!] Please close any current Xcode sessions and use
EmptyProject.xcworkspace
for this project from now on. Sending stats Pod installation complete! There is 1 dependency from the Podfile and 1 total pod installed. Generating C# bindings for non-Framework pod lottie-ios /Users/username1/Projects/objc-automatic/pods/lottie_ios/XCode/build-out does not exist. Creating /Users/username1/Projects/objc-automatic/pods/lottie_ios/XCode/build-out /Users/username1/Projects/objc-automatic/bindings/lottie_ios does not exist. Creating /Users/username1/Projects/objc-automatic/bindings/lottie_ios xcodebuild clean build -workspace EmptyProject.xcworkspace -scheme EmptyProject -sdk "iphoneos" CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO ONLY_ACTIVE_ARCH=NO SYMROOT=/Users/username1/Projects/objc-automatic/pods/lottie_ios/XCode/build-out CONFIGURATION_BUILD_DIR=/Users/username1/Projects/objc-automatic/pods/lottie_ios/XCode/build-out 2017-03-22 10:14:58.204 xcodebuild[64657:38812182] [MT] PluginLoading: Required plug-in compatibility UUID E0A62D1F-3C18-4D74-BFE5-A4167D643966 for plug-in at path '~/Library/Application Support/Developer/Shared/Xcode/Plug-ins/Unity4XC.xcplugin' not present in DVTPlugInCompatibilityUUIDs Build settings from command line: CODE_SIGN_IDENTITY = CODE_SIGNING_REQUIRED = NO CONFIGURATION_BUILD_DIR = /Users/username1/Projects/objc-automatic/pods/lottie_ios/XCode/build-out ONLY_ACTIVE_ARCH = NO SDKROOT = iphoneos10.2 SYMROOT = /Users/username1/Projects/objc-automatic/pods/lottie_ios/XCode/build-out=== CLEAN TARGET lottie-ios OF PROJECT Pods WITH CONFIGURATION Debug ===
Check dependencies
...... here goes compilation .......
BUILD SUCCEEDED
VERIFY: pod lottie-ios doesn't have any binaries generated for config -sdk "iphoneos" VERIFY: pod lottie-ios most probably doesn't have any binaries generated Umbrella packages will be generated for these pods [] Deleting /Users/username1/Projects/objc-automatic/bindings/packages-raw Creating /Users/username1/Projects/objc-automatic/bindings/packages-raw Deleting /Users/username1/Projects/objc-automatic/bindings/packages-good Creating /Users/username1/Projects/objc-automatic/bindings/packages-good Deleting /Users/username1/Projects/objc-automatic/bindings/packages-tmp Creating /Users/username1/Projects/objc-automatic/bindings/packages-tmp Finished Target: Bind
Build Time Report
Target Duration
Bind 00:01:12.5714566 Total: 00:01:12.6152645 Status: Ok
Here is the content of the script after this:
username1$ cat bindings/lottie_ios.build.sh
!/bin/bash
set -e rm -rf packages-tmp/. rm -rf packages-good/. rm -rf packages-raw/. nuget sources Remove -Name DT.Automatic || true nuget sources Add -Name DT.Automatic -Source /Users/username1/Projects/objc-automatic/bindings/packages-good
Here is Nuget version:
nuget ? NuGet Version: 3.5.0.1996
@InfiniteCode bindings should be built for simulator and device. Can you share a sample app that uses this editor so I can check if these bindings work at all?
On the log, it is strange to see that:
VERIFY: pod lottie-ios doesn't have any binaries generated for config -sdk "iphoneos"
VERIFY: pod lottie-ios most probably doesn't have any binaries generated
I'll think what information could I need to find what's going on. What XCode version do you have? Do you use latest master code for objc-automatic
?
XCode is 8.2.1, objc-automatic and sharpie are the latest from master.
username1$ xcodebuild -version
Xcode 8.2.1
Build version 8C1002
I will create a sample app later today.
@alexsorokoletov Here is the sample project which doesn't compile. It was a strange behavior as well during nuget install. I added it to the packages list and clicked restore. It did find it in the local repo, and added to the project.
However, it didn't add a DLL to the references in project preferences. So, I had to manually go there and add it, so it can start seeing the namespaces.
https://github.com/InfiniteCode/CopterBuddy/raw/master/REVTest.zip
Checking.
My mistake, package was build in kind of a mixed mode and I had to edit .linkwith.cs
file to make sure it references RichEditView.framework
but not RichEditView.a
Also, I tried installing this package in your solution (I removed bad package and added freshly built from my internal nuget source) and it added reference just fine.
I have checked and now solution compiles for Simulator but does not for device
ld: warning: linking against a dylib which is not safe for use in application extensions: /Users/alex/Downloads/REVTest/REVTest/obj/iPhone/Debug/mtouch-cache/RichEditorView.framework/RichEditorView
Undefined symbols for architecture arm64:
"_OBJC_CLASS_$_RichBarButtonItem", referenced from:
-u command line option
"_OBJC_CLASS_$_RichEditorToolbar", referenced from:
-u command line option
"_OBJC_CLASS_$_RichEditorView", referenced from:
-u command line option
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I feel like compilation from cocoapod to framework should be better, need to work on that.
@InfiniteCode I will have some time later this week to look at this. This is really interesting topic and I feel like we can easily add support for swift-based cocoapods. How "easily" is undefined yet.
@alexsorokoletov Very appreciated! Need that one badly :)
@alexsorokoletov Hey Alex, is there any progress on this matter? Thanks!
Looking at this today, @InfiniteCode
@InfiniteCode I was not able to make this work. Simulator build is still crashing and device build cannot AOT the dll. Following this documentation and samples but can't find what's wrong.
Complication to all this, RichEditorView is in Swift 2 originally so I am not sure how XCode updated it to Swift 3. Unfortunately, there is nothing I can do now.
My best guess would be to follow the documentation on Swift bindings for Xamarin and do the bindings manually.
objc-automatic
can't help with cocoapods written in Swift (yet).
@alexsorokoletov Ah ... it's a pity. Anyway, thanks for trying!
@alexsorokoletov I decided to use a different library, which is not Swift based. Having troubles with it as well: ZSSRichTextEditor
On the bright side, it was able to generate proper binding build script. However, once launched it started throwing some undefined references:
error CS0246: The type or namespace name `IHRColorPickerViewControllerDelegate' could not be found. Are you missing an assembly reference?
error CS0246: The type or namespace name `ZSSBarButtonItem' could not be found. Are you missing an assembly reference?
It seems that some of the dependencies were not properly detected. Here is the initial bind POD output:
sh bind.sh POD=ZSSRichTextEditor
Checking Paket version (downloading latest stable)...
Paket.exe 4.0.11 is up to date.
Paket version 4.0.11
Skipping resolver for group Auto since it is already up-to-date
Skipping resolver for group Main since it is already up-to-date
/Users/username1/Projects/objc-automatic-master/paket.lock is already up-to-date
2 seconds - ready.
Building project with version: LocalBuild
Shortened DependencyGraph for Target Bind:
<== Bind
The resulting target order is:
- Bind
Starting Target: Bind
VERBOSE IS false
List of pods: ["ZSSRichTextEditor"]
Sorted dependency graph: ["ZSSRichTextEditor"]
Deleting /Users/username1/Projects/objc-automatic-master/pods/ZSSRichTextEditor/XCode
Creating /Users/username1/Projects/objc-automatic-master/pods/ZSSRichTextEditor/XCode
/Users/username1/Projects/objc-automatic-master/pods/ZSSRichTextEditor/XCode already exists.
pod install
Generating C# bindings for non-Framework pod ZSSRichTextEditor
/Users/username1/Projects/objc-automatic-master/pods/ZSSRichTextEditor/XCode/build-out does not exist.
Creating /Users/username1/Projects/objc-automatic-master/pods/ZSSRichTextEditor/XCode/build-out
/Users/username1/Projects/objc-automatic-master/bindings/ZSSRichTextEditor does not exist.
Creating /Users/username1/Projects/objc-automatic-master/bindings/ZSSRichTextEditor
xcodebuild clean build -workspace EmptyProject.xcworkspace -scheme EmptyProject -sdk "iphoneos" CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO ONLY_ACTIVE_ARCH=NO SYMROOT=/Users/username1/Projects/objc-automatic-master/pods/ZSSRichTextEditor/XCode/build-out CONFIGURATION_BUILD_DIR=/Users/username1/Projects/objc-automatic-master/pods/ZSSRichTextEditor/XCode/build-out
xcodebuild clean build -workspace EmptyProject.xcworkspace -scheme EmptyProject -arch i386 -arch x86_64 -sdk "iphonesimulator" CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO ONLY_ACTIVE_ARCH=NO SYMROOT=/Users/username1/Projects/objc-automatic-master/pods/ZSSRichTextEditor/XCode/build-out CONFIGURATION_BUILD_DIR=/Users/username1/Projects/objc-automatic-master/pods/ZSSRichTextEditor/XCode/build-out
lipo -create -output pods/ZSSRichTextEditor/XCode/build-out/libZSSRichTextEditor.a /Users/username1/Projects/objc-automatic-master/pods/ZSSRichTextEditor/XCode/build-out/libZSSRichTextEditor.device.a /Users/username1/Projects/objc-automatic-master/pods/ZSSRichTextEditor/XCode/build-out/libZSSRichTextEditor.sim.a
sharpie -tlm-do-not-submit bind -output bindings/ZSSRichTextEditor -sdk "iphoneos" -scope pods/ZSSRichTextEditor/XCode/build-out pods/ZSSRichTextEditor/XCode/build-out/ZSSRichTextEditor.h -n DreamTeam.Xamarin.ZSSRichTextEditor -c -I pods/ZSSRichTextEditor/XCode/Pods/Headers/Private -Ipods/ZSSRichTextEditor/XCode/Pods/Headers/Public -v
Creating /Users/username1/Projects/objc-automatic-master/bindings/ZSSRichTextEditor/Properties
Umbrella packages will be generated for these pods []
Deleting /Users/username1/Projects/objc-automatic-master/bindings/packages-raw
Creating /Users/username1/Projects/objc-automatic-master/bindings/packages-raw
Deleting /Users/username1/Projects/objc-automatic-master/bindings/packages-good
Creating /Users/username1/Projects/objc-automatic-master/bindings/packages-good
Deleting /Users/username1/Projects/objc-automatic-master/bindings/packages-tmp
Creating /Users/username1/Projects/objc-automatic-master/bindings/packages-tmp
Finished Target: Bind
---------------------------------------------------------------------
Build Time Report
---------------------------------------------------------------------
Target Duration
------ --------
Bind 00:00:07.9526608
Total: 00:00:07.9933798
Status: Ok
---------------------------------------------------------------------
I tried temporarily to comment out those lines and building ended up failing on another error:
objc-automatic-master/bindings/ZSSRichTextEditor/obj/Release/ios/DreamTeamXamarinZSSRichTextEditor/HRColorPickerViewController.g.cs(190,10): error CS0246: The type or namespace name
HRColorPickerViewControllerDelegate' could not be found. Are you missing an assembly reference?`
Is there something else to be done or modified to make it working?
Thanks!
These are Xamarin.iOS binding errors. You have to adjust ApiDefinition.cs file manually to resolve these errors.
My guess regarding IHRColorPickerViewControllerDelegate
would is that you should just add in the very beginning of the ApiDefinition.cs file
public partial interface IHRColorPickerViewControllerDelegate { }
and that's it.
Trying to generate bindings for RichEditorView cocoapod. Seems like the build script is not fully generated:
Is there any reason why it fails?