goal c – iOS Dylib crashes when printed to testflight with CODESIGNING 2 Invalid Web page

0
1
goal c – iOS Dylib crashes when printed to testflight with CODESIGNING 2 Invalid Web page


It is a prolonged one. I’ve mainly compiled a Rust binary right into a dylib and packaged right into a .xcframework that incorporates per arch .frameworks. This hundreds accurately when run from Xcode into an actual iOS gadget. Nonetheless, when deployed to TestFlight the app crashes.

Here’s what is a bit completely different, the dylib just isn’t absolutely self-contained. It tries to succeed in in an use C features I’ve uncovered in my library code. Calling features which can be simply inside the dylib and simply return works tremendous, however the second it tries to name one of many uncovered features it crashes.

A full in-depth step-by-step of how I packaged the binaries might be present in my web site:

https://ospfranco.com/complete-guide-to-dylibs-in-ios-and-android

After I have a look at the TestFlight crash report there aren’t any symbols however the termination trigger by way of WatchDog is:

Termination Purpose: CODESIGNING 2 Invalid Web page

I’ve declared my features as such:

OBJC_EXTERN void ios_prepare_request(const char *url)
#outline EXPORT __attribute__((visibility("default"), used, retain))
 
extern "C" {
 
EXPORT void ios_prepare_request(const char *url) {
  NSString *urlString = [NSString stringWithUTF8String:url];
  request =
      [NSMutableURLRequest requestWithURL:[NSURL URLWithString:urlString]];
}
 
}
 
// Perform used to stop optimization
void force_symbol_registration() {
  // Pressure these symbols to be included within the binary by referencing them
  risky void *ptrs[] = {(void *)ios_prepare_request,};
 
  // Stop compiler from optimizing away the array
  (void)ptrs;
}

And I load my framework as:

  opacity::force_symbol_registration();
 
  // NSBundle *dylib_bundle =
  //     [NSBundle bundleWithIdentifier:@"com.opacitylabs.sdk"];
  // NSString *dylib_path = [dylib_bundle pathForResource:@"sdk" ofType:@""];
 
  // // Load the dynamic library
  // void *deal with = dlopen([dylib_path UTF8String], RTLD_NOW | RTLD_GLOBAL);
  // if (!deal with) {
  //   NSString *errorMessage = [NSString stringWithUTF8String:dlerror()];
  //   *error =
  //       [NSError errorWithDomain:@"OpacitySDKDylibError"
  //                           code:1002
  //                       userInfo:@{NSLocalizedDescriptionKey :
  //                       errorMessage}];
  //   return -1; // or applicable error code
  // }
 
  // Be sure that the principle executable's symbols can be found
  dlopen(NULL, RTLD_NOW | RTLD_GLOBAL);
 
  NSBundle *frameworkBundle =
      [NSBundle bundleWithIdentifier:@"com.opacitylabs.sdk"];
  if (![frameworkBundle isLoaded]) {
    BOOL success = [frameworkBundle load];
    if (!success) {
      NSString *errorMessage = @"Did not load framework";
      *error =
          [NSError errorWithDomain:@"OpacitySDKDylibError"
                              code:1002
                          userInfo:@{NSLocalizedDescriptionKey : errorMessage}];
      return -1;
    }
  }
  • As you may see, I’ve additionally tried dlopen each work when run from Xcode however crash when deployed on testflight.
  • I’ve tried re-signing the xcframework/frameworks on a pre construct step but it surely would not work
  • As acknowledged, I can name the features contained in the dylib, however as soon as they attempt to name my uncovered code it crashes

Is that this achievable in any respect or only a limitation of the iOS sandbox?

LEAVE A REPLY

Please enter your comment!
Please enter your name here