bitstadium / HockeySDK-iOS

HockeyApp was retired and the SDKs are deprecated. Please use App Center instead.
https://github.com/microsoft/appcenter-sdk-apple
Other
597 stars 268 forks source link

Called object type 'BITHockeyManager * _Nonnull' is not a function or function pointer #476

Closed alxvallejo closed 6 years ago

alxvallejo commented 6 years ago

I'm getting this error when i add the following to my AppDelegate.m file:

BITHockeyManager.sharedHockeyManager().configureWithIdentifier("30e495ce698449d49f71d3a493ce32a3")
  // Do some additional configuration if needed here
  BITHockeyManager.sharedHockeyManager().startManager()
  BITHockeyManager.sharedHockeyManager().authenticator.authenticateInstallation()

Here's the whole thing:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{

  NSURL *jsCodeLocation;

  [FIRApp configure];

  // when debug release in react native, use the index.ios
  jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index.ios" fallbackResource:nil];
  // otherwise, use this for real builds:
  //jsCodeLocation = [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];

  for (NSString* family in [UIFont familyNames])
  {
    NSLog(@"%@", family);
    for (NSString* name in [UIFont fontNamesForFamilyName: family])
    {
      NSLog(@" %@", name);
    }
  }

  RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation
                                                      moduleName:@"dayoff"
                                               initialProperties:nil
                                                   launchOptions:launchOptions];
  rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1];

  self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
  UIViewController *rootViewController = [UIViewController new];
  rootViewController.view = rootView;
  self.window.rootViewController = rootViewController;
  [self.window makeKeyAndVisible];
  // return YES;
  [SplashScreen show];

  [[UNUserNotificationCenter currentNotificationCenter] setDelegate:self];

  BITHockeyManager.sharedHockeyManager().configureWithIdentifier("xxxx")
  // Do some additional configuration if needed here
  BITHockeyManager.sharedHockeyManager().startManager()
  BITHockeyManager.sharedHockeyManager().authenticator.authenticateInstallation()

  return [[FBSDKApplicationDelegate sharedInstance] application:application
                                  didFinishLaunchingWithOptions:launchOptions];
}

I apologize if this code is ugly - not a Swift dev. This is a React Native project.

ElektrojungeAtWork commented 6 years ago

Hey @alxvallejo, thx for getting in touch.

One thing that I see above is that your are using Objective-C for your app but try to setup HockeyApp in Swift. You need to setup HockeySDK-iOS in Objective-C, too.

[[BITHockeyManager sharedHockeyManager] configureWithIdentifier:@"APP_IDENTIFIER"];
  // Do some additional configuration if needed here
  [[BITHockeyManager sharedHockeyManager] startManager];
  [[BITHockeyManager sharedHockeyManager].authenticator authenticateInstallation]; // This line is obsolete in the crash only builds

That said, HockeyApp does not support react native projects. Tthere is an inofficial port of our SDK for RN. Maybe you can try using that.

One more thing: I notice that you are also using Firebase above. Please note that it's not possible to have more than one crash reporting tool in an iOS application.

Best, Benjamin