fix(ios): ok

This commit is contained in:
devthejo 2025-12-10 13:46:47 +01:00
parent de22655d72
commit c2285691a7
2 changed files with 90 additions and 8 deletions

View file

@ -196,9 +196,10 @@
BAD00DBFD7D44CD2956A18DF /* Fix Xcode 15 Bug */, BAD00DBFD7D44CD2956A18DF /* Fix Xcode 15 Bug */,
9E6F0A1338934BA5AD468D4B /* Fix Xcode 15 Bug */, 9E6F0A1338934BA5AD468D4B /* Fix Xcode 15 Bug */,
229987488EA44E69AA932D58 /* Fix Xcode 15 Bug */, 229987488EA44E69AA932D58 /* Fix Xcode 15 Bug */,
1B0B11FFE0884C2B9A75B09D /* Remove signature files (Xcode workaround) */,
A891237ADBD54747890A99FB /* Fix Xcode 15 Bug */, A891237ADBD54747890A99FB /* Fix Xcode 15 Bug */,
B700EE07E2A24654A0953D3B /* Remove signature files (Xcode workaround) */, B700EE07E2A24654A0953D3B /* Remove signature files (Xcode workaround) */,
9E272D599E42446BB8DFD8D0 /* Fix Xcode 15 Bug */,
CBAD4F53ADB04F499371D5DE /* Remove signature files (Xcode workaround) */,
); );
buildRules = ( buildRules = (
); );
@ -1031,6 +1032,40 @@ fi";
shellScript = " shellScript = "
echo \"Remove signature files (Xcode workaround)\"; echo \"Remove signature files (Xcode workaround)\";
rm -rf \"$CONFIGURATION_BUILD_DIR/MapLibre.xcframework-ios.signature\"; rm -rf \"$CONFIGURATION_BUILD_DIR/MapLibre.xcframework-ios.signature\";
";
};
9E272D599E42446BB8DFD8D0 /* Fix Xcode 15 Bug */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
name = "Fix Xcode 15 Bug";
inputPaths = (
);
outputPaths = (
);
shellPath = /bin/sh;
shellScript = "if [ \"$XCODE_VERSION_MAJOR\" = \"1500\" ]; then
echo \"Remove signature files (Xcode 15 workaround)\"
find \"$BUILD_DIR/${CONFIGURATION}-iphoneos\" -name \"*.signature\" -type f | xargs -r rm
fi";
};
CBAD4F53ADB04F499371D5DE /* Remove signature files (Xcode workaround) */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
name = "Remove signature files (Xcode workaround)";
inputPaths = (
);
outputPaths = (
);
shellPath = /bin/sh;
shellScript = "
echo \"Remove signature files (Xcode workaround)\";
rm -rf \"$CONFIGURATION_BUILD_DIR/MapLibre.xcframework-ios.signature\";
"; ";
}; };
/* End PBXShellScriptBuildPhase section */ /* End PBXShellScriptBuildPhase section */

View file

@ -1,29 +1,76 @@
import ExpoModulesCore import EXUpdates
import FirebaseCore import FirebaseCore
import React
import TSBackgroundFetch
import UIKit import UIKit
@objc(AppDelegate) @objc(AppDelegate)
class AppDelegate: ExpoAppDelegate { class AppDelegate: RCTAppDelegate {
override func application( override func application(
_ application: UIApplication, _ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil
) -> Bool { ) -> Bool {
// Log to verify the new ExpoAppDelegate-based path runs on iOS. NSLog("[AppDelegate] didFinishLaunchingWithOptions (RCTAppDelegate)")
NSLog("[AppDelegate] didFinishLaunchingWithOptions (ExpoAppDelegate)")
// Configure Firebase (react-native-firebase) // Configure Firebase (react-native-firebase).
FirebaseApp.configure() FirebaseApp.configure()
// Transistorsoft background fetch bootstrap. // Transistorsoft background fetch bootstrap.
TSBackgroundFetch.sharedInstance().didFinishLaunching() TSBackgroundFetch.sharedInstance().didFinishLaunching()
NSLog("[AppDelegate] TSBackgroundFetch didFinishLaunching") NSLog("[AppDelegate] TSBackgroundFetch didFinishLaunching")
// Initialize expo-updates controller so AppController.sharedInstance can be used safely.
AppController.initializeWithoutStarting()
AppController.sharedInstance.start()
// Configure React Native root module. // Configure React Native root module.
moduleName = "main" self.moduleName = "main"
initialProps = [:] self.initialProps = [:]
let result = super.application(application, didFinishLaunchingWithOptions: launchOptions) let result = super.application(application, didFinishLaunchingWithOptions: launchOptions)
NSLog("[AppDelegate] super.application(...) -> %@", result ? "true" : "false") NSLog("[AppDelegate] super.application(...) -> %@", result ? "true" : "false")
return result return result
} }
// MARK: - RCTBridgeDelegate / JS bundle location
@objc
override func sourceURL(for bridge: RCTBridge!) -> URL! {
#if DEBUG
let url = RCTBundleURLProvider.sharedSettings().jsBundleURL(
forBundleRoot: ".expo/.virtual-metro-entry",
fallbackExtension: nil
)
NSLog("[AppDelegate] sourceURL(for:) (DEBUG) -> %@", url?.absoluteString ?? "nil")
return url
#else
let url = self.bundleURL()
NSLog("[AppDelegate] sourceURL(for:) (RELEASE) -> %@", url?.absoluteString ?? "nil")
return url
#endif
}
@objc
override func bundleURL() -> URL! {
#if DEBUG
let url = RCTBundleURLProvider.sharedSettings().jsBundleURL(
forBundleRoot: ".expo/.virtual-metro-entry",
fallbackExtension: nil
)
NSLog("[AppDelegate] bundleURL() (DEBUG) -> %@", url?.absoluteString ?? "nil")
return url
#else
if let updatesURL = AppController.sharedInstance.launchAssetUrl() {
NSLog("[AppDelegate] bundleURL() (RELEASE) -> %@", updatesURL.absoluteString)
return updatesURL
}
let url = Bundle.main.url(forResource: "main", withExtension: "jsbundle")
if let url = url {
NSLog("[AppDelegate] bundleURL() (RELEASE fallback) -> %@", url.absoluteString)
} else {
NSLog("[AppDelegate] bundleURL() (RELEASE fallback) -> nil (main.jsbundle not found)")
}
return url
#endif
}
} }