diff --git a/example/ios/Podfile b/example/ios/Podfile index fa78542f2..85b2fdd3c 100644 --- a/example/ios/Podfile +++ b/example/ios/Podfile @@ -8,7 +8,7 @@ podfile_properties = JSON.parse(File.read(File.join(__dir__, 'Podfile.properties ENV['RCT_NEW_ARCH_ENABLED'] = podfile_properties['newArchEnabled'] == 'true' ? '1' : '0' ENV['EX_DEV_CLIENT_NETWORK_INSPECTOR'] = '1' if podfile_properties['EX_DEV_CLIENT_NETWORK_INSPECTOR'] == 'true' -platform :ios, '16.0' +platform :ios, '14.0' install! 'cocoapods', :deterministic_uuids => false @@ -85,11 +85,11 @@ target 'xmtpreactnativesdkexample' do installer.generated_projects.each do |project| project.targets.each do |target| target.build_configurations.each do |config| - config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '16.0' + config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '14.0' end end project.build_configurations.each do |config| - config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '16.0' + config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '14.0' end end end diff --git a/example/ios/Podfile.lock b/example/ios/Podfile.lock index 851eca939..da7545c93 100644 --- a/example/ios/Podfile.lock +++ b/example/ios/Podfile.lock @@ -767,6 +767,6 @@ SPEC CHECKSUMS: XMTPReactNative: 1ca02155e4583791c8c99a244206ecf8e057abd2 Yoga: e71803b4c1fff832ccf9b92541e00f9b873119b9 -PODFILE CHECKSUM: 95d6ace79946933ecf80684613842ee553dd76a2 +PODFILE CHECKSUM: 0e6fe50018f34e575d38dc6a1fdf1f99c9596cdd COCOAPODS: 1.15.2 diff --git a/ios/XMTPModule.swift b/ios/XMTPModule.swift index 788b0fa9c..cfb98b133 100644 --- a/ios/XMTPModule.swift +++ b/ios/XMTPModule.swift @@ -1483,14 +1483,23 @@ public class XMTPModule: Module { AsyncFunction("exportNativeLogs") { () -> String in var logOutput = "" - let logStore = try OSLogStore(scope: .currentProcessIdentifier) - let position = logStore.position(timeIntervalSinceLatestBoot: -300) // Last 5 min of logs - let entries = try logStore.getEntries(at: position) + if #available(iOS 15.0, *) { + do { + let logStore = try OSLogStore(scope: .currentProcessIdentifier) + let position = logStore.position(timeIntervalSinceLatestBoot: -300) // Last 5 min of logs + let entries = try logStore.getEntries(at: position) - for entry in entries { - if let logEntry = entry as? OSLogEntryLog { - logOutput.append("\(logEntry.date): \(logEntry.composedMessage)\n") + for entry in entries { + if let logEntry = entry as? OSLogEntryLog { + logOutput.append("\(logEntry.date): \(logEntry.composedMessage)\n") + } + } + } catch { + logOutput = "Failed to fetch logs: \(error.localizedDescription)" } + } else { + // Fallback for iOS 14 + logOutput = "OSLogStore is only available on iOS 15 and above. Logging is not supported on this iOS version." } return logOutput