I'm creating a CodePush
Xamarin.iOS binding, I've generated a fat lib .a
file by using sharpie tool with the CodePush
cocoapod:
sharpie pod init ios CodePush
sharpie pod bind
And then created a Xamarin.iOS binding project with .a
file and libCodePush.linkwith.cs
definition:
[assembly: LinkWith(
"libCodePush.a",
LinkTarget.ArmV7 | LinkTarget.Arm64 | LinkTarget.i386 | LinkTarget.x86_64,
LinkerFlags = "-ObjC -lz",
IsCxx = false,
SmartLink = false,
ForceLoad = true)]
My ApiDefinition.cs
with added bundleURL (the only property I need from the binding so I removed all the rest):
// @interface CodePush : NSObject
[BaseType(typeof(NSObject))]
public interface CodePush
{
// + (NSURL *)bundleURL
[Static]
[Export("bundleURL")]
NSUrl BundleUrl { get; }
}
And then simple app bootstrap (assuming that RN binding is added as well):
var window = new UIWindow(UIScreen.MainScreen.Bounds);
// case 1: with this line the app works fine and RN app is loaded
// var url = NSBundle.MainBundle.GetUrlForResource("main", "jsbundle");
// case 2: if this line uncommented the app is crashed on startup
var url = CodePush.BundleUrl;
var rootView = new RCTRootView(url, new NSString("codePushBinding"), new NSDictionary(), launchOptions);
var vc = new UIViewController();
vc.View = rootView;
window.RootViewController = vc;
window.MakeKeyAndVisible();
With the CodePush.BundleUrl
line uncommented the app crashes on the app startup, I'm unable to access any debug information, no crash reports on device logs, no crash data in app output.
What could be wrong with the binding definition and how can I debug this issue?