Closed batcodegen closed 1 year ago
Hi @batcodegen,
We haven't checked compatibility of our plugin with that library and we didn't have it in the plan yet. We'll be able to test it by the end of June and get back to you with more details after that.
Thanks a lot for providing all the necessary details for us.
BR, Tereza
Hi @batcodegen we seems found the possible root cause of it, image picker plugin takes rootVC like this:
UIViewController *root = [[[[UIApplication sharedApplication] delegate] window] rootViewController];
however for react-native other way should be used RCTKeyWindow()?.rootViewController
, so image-picker plugin gets nil because window isn't yet setup when [MobileMessagingPluginApplicationDelegate install];
was called.
We'll fix it on our side, but it can take some time, so as a workaround you can try following solution:
Please, try to call [MobileMessagingPluginApplicationDelegate install];
not at the beginning of the didFinishLaunchingWithOptions
method, but after window was setup:
(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
-[MobileMessagingPluginApplicationDelegate install];
[FIRApp configure];
#ifdef FB_SONARKIT_ENABLED
InitializeFlipper(application);
#endif
RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions];
RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge
moduleName:@"Example"
initialProperties:nil];
if (@available(iOS 13.0, *)) {
rootView.backgroundColor = [UIColor systemBackgroundColor];
} else {
rootView.backgroundColor = [UIColor whiteColor];
}
self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
UIViewController *rootViewController = [UIViewController new];
rootViewController.view = rootView;
self.window.rootViewController = rootViewController;
[self.window makeKeyAndVisible];
+[MobileMessagingPluginApplicationDelegate install];
[RNSplashScreen show];
return YES;
}
@riskpp Thanks for the update. We were able to fix the issue with this workaround.
Great, closing the issue
Issue
Adding react-native-image-crop-picker library along with this library causes crop picker to stop working.
After installation of the Infobip plugin we are unable to open the image picker and are faced with the following error in XCode : [ChangeHandling] API misuse: pauseChangeHandling called when changeHandlingContainer is nil (never initialized or already invalidated).
We have followed manual installation on iOS using these steps
Project Files
Javascript
Click To Expand
#### `package.json`: ```json "dependencies": { "infobip-mobile-messaging-react-native-plugin": "^6.0.0", "react": "17.0.2", "react-native": "0.68.2", "react-native-image-crop-picker": "^0.37.3" } ```
iOS
Click To Expand
#### `ios/Podfile`: - [ ] I'm not using Pods - [x] I'm using Pods and my Podfile looks like: ```ruby require_relative '../node_modules/react-native/scripts/react_native_pods' require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules' platform :ios, '11.0' target 'Example' do config = use_native_modules! use_react_native!( :path => config[:reactNativePath], # to enable hermes on iOS, change `false` to `true` and then install pods :hermes_enabled => true ) post_integrate do |installer| project = Xcodeproj::Project.open("Example.xcodeproj") project.targets.each do |target| script_need_to_be_removed = '[CP] Check Pods Manifest.lock' phase = target.shell_script_build_phases.select { |phase| phase.name.include?(script_need_to_be_removed) }.first unless phase.nil? target.build_phases.delete(phase) puts "script #{script_need_to_be_removed} removed" end end project.save() end # Enables Flipper. # # Note that if you have use_frameworks! enabled, Flipper will not work and # you should disable the next line. use_flipper!() post_install do |installer| installer.pods_project.targets.each do |target| target.build_configurations.each do |config| config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64 i386" end end react_native_post_install(installer) __apply_Xcode_12_5_M1_post_install_workaround(installer) end end ``` #### `AppDelegate.m`: ```objc #import "AppDelegate.h" #import
#import
#import
#import "RNSplashScreen.h"
#import
#import
#ifdef FB_SONARKIT_ENABLED
#import
#import
#import
#import
#import
#import
static void InitializeFlipper(UIApplication *application) {
FlipperClient *client = [FlipperClient sharedClient];
SKDescriptorMapper *layoutDescriptorMapper = [[SKDescriptorMapper alloc] initWithDefaults];
[client addPlugin:[[FlipperKitLayoutPlugin alloc] initWithRootNode:application withDescriptorMapper:layoutDescriptorMapper]];
[client addPlugin:[[FKUserDefaultsPlugin alloc] initWithSuiteName:nil]];
[client addPlugin:[FlipperKitReactPlugin new]];
[client addPlugin:[[FlipperKitNetworkPlugin alloc] initWithNetworkAdapter:[SKIOSNetworkAdapter new]]];
[client start];
}
#endif
@import MobileMessaging;
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
[MobileMessagingPluginApplicationDelegate install];
[FIRApp configure];
#ifdef FB_SONARKIT_ENABLED
InitializeFlipper(application);
#endif
RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions];
RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge
moduleName:@"Example"
initialProperties:nil];
if (@available(iOS 13.0, *)) {
rootView.backgroundColor = [UIColor systemBackgroundColor];
} else {
rootView.backgroundColor = [UIColor whiteColor];
}
self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
UIViewController *rootViewController = [UIViewController new];
rootViewController.view = rootView;
self.window.rootViewController = rootViewController;
[self.window makeKeyAndVisible];
[RNSplashScreen show];
return YES;
}
- (NSURL *)sourceURLForBridge:(RCTBridge *)bridge
{
#if DEBUG
return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];
#else
return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
#endif
}
@end
```
Environment
Click To Expand
**`react-native info` output:** ``` System: OS: macOS 12.3.1 CPU: (8) arm64 Apple M1 Memory: 83.39 MB / 16.00 GB Shell: 5.8 - /bin/zsh Binaries: Node: 17.7.2 - /opt/homebrew/bin/node Yarn: Not Found npm: 8.5.2 - /opt/homebrew/bin/npm Watchman: 2022.03.14.00 - /opt/homebrew/bin/watchman Managers: CocoaPods: 1.11.3 - /usr/local/bin/pod SDKs: iOS SDK: Platforms: DriverKit 21.2, iOS 15.2, macOS 12.1, tvOS 15.2, watchOS 8.3 Android SDK: Not Found IDEs: Android Studio: 2021.2 AI-212.5712.43.2112.8512546 Xcode: 13.2.1/13C100 - /usr/bin/xcodebuild Languages: Java: 11.0.11 - /usr/bin/javac npmPackages: @react-native-community/cli: Not Found react: 17.0.2 => 17.0.2 react-native: 0.66.4 => 0.66.4 react-native-macos: Not Found npmGlobalPackages: *react-native*: Not Found ``` - **Platform that you're experiencing the issue on**: - [x] iOS - [ ] Android - **`infobip/mobile-messaging-react-native-plugin` version you're using that has this issue:** - 6.0.0 - **Are you using `TypeScript`?** - `N`