From cf9f8da17733278e15766695f3a0e379c56b7548 Mon Sep 17 00:00:00 2001 From: Dhiogo Brustolin Date: Wed, 22 Nov 2023 10:38:44 +0100 Subject: [PATCH 01/22] fix: External view controller transactions not finished --- .../iOS-External/ExternalViewController.swift | 12 + Samples/iOS-Swift/iOS-External/iOS_External.h | 10 + .../iOS-Swift.xcodeproj/project.pbxproj | 272 ++++++++++++++++++ Samples/iOS-Swift/iOS-Swift/AppDelegate.swift | 2 + .../iOS-Swift/Base.lproj/Main.storyboard | 27 +- Sentry.xcodeproj/project.pbxproj | 16 +- .../ExternalUIViewController.swift | 10 + Sources/Sentry/SentryBinaryImageCache.m | 13 + Sources/Sentry/SentryInAppLogic.m | 8 - Sources/Sentry/SentrySDK.m | 3 +- .../Sentry/SentryUIViewControllerSwizzling.m | 24 +- .../HybridPublic/SentryBinaryImageCache.h | 2 + Sources/Sentry/include/SentryInAppLogic.h | 4 + ...SentryUIViewControllerSwizzlingTests.swift | 28 ++ 14 files changed, 402 insertions(+), 29 deletions(-) create mode 100644 Samples/iOS-Swift/iOS-External/ExternalViewController.swift create mode 100644 Samples/iOS-Swift/iOS-External/iOS_External.h create mode 100644 SentryTestUtils/ExternalUIViewController.swift diff --git a/Samples/iOS-Swift/iOS-External/ExternalViewController.swift b/Samples/iOS-Swift/iOS-External/ExternalViewController.swift new file mode 100644 index 00000000000..04c8f586586 --- /dev/null +++ b/Samples/iOS-Swift/iOS-External/ExternalViewController.swift @@ -0,0 +1,12 @@ +import Foundation +import Sentry +import UIKit + +class ExternalViewController: UIViewController { + + override func viewDidAppear(_ animated: Bool) { + super.viewDidAppear(animated) + SentrySDK.reportFullyDisplayed() + } + +} diff --git a/Samples/iOS-Swift/iOS-External/iOS_External.h b/Samples/iOS-Swift/iOS-External/iOS_External.h new file mode 100644 index 00000000000..6888dc783b9 --- /dev/null +++ b/Samples/iOS-Swift/iOS-External/iOS_External.h @@ -0,0 +1,10 @@ +#import + +//! Project version number for iOS_External. +FOUNDATION_EXPORT double iOS_ExternalVersionNumber; + +//! Project version string for iOS_External. +FOUNDATION_EXPORT const unsigned char iOS_ExternalVersionString[]; + +// In this header, you should import all the public headers of your framework using statements like +// #import diff --git a/Samples/iOS-Swift/iOS-Swift.xcodeproj/project.pbxproj b/Samples/iOS-Swift/iOS-Swift.xcodeproj/project.pbxproj index a2999fd97a8..6b7c95a07f6 100644 --- a/Samples/iOS-Swift/iOS-Swift.xcodeproj/project.pbxproj +++ b/Samples/iOS-Swift/iOS-Swift.xcodeproj/project.pbxproj @@ -41,6 +41,11 @@ 84FB812A284001B800F3A94A /* SentryBenchmarking.mm in Sources */ = {isa = PBXBuildFile; fileRef = 84FB8129284001B800F3A94A /* SentryBenchmarking.mm */; }; 84FB812B284001B800F3A94A /* SentryBenchmarking.mm in Sources */ = {isa = PBXBuildFile; fileRef = 84FB8129284001B800F3A94A /* SentryBenchmarking.mm */; }; 8E8C57AF25EF16E6001CEEFA /* TraceTestViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8E8C57AE25EF16E6001CEEFA /* TraceTestViewController.swift */; }; + D80C98F22B0D077E0052F311 /* iOS_External.h in Headers */ = {isa = PBXBuildFile; fileRef = D80C98F12B0D077E0052F311 /* iOS_External.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D80C98F52B0D077E0052F311 /* iOS_External.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D80C98EF2B0D077E0052F311 /* iOS_External.framework */; }; + D80C98F62B0D077E0052F311 /* iOS_External.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = D80C98EF2B0D077E0052F311 /* iOS_External.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + D80C99082B0D07DA0052F311 /* ExternalViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D80C99072B0D07DA0052F311 /* ExternalViewController.swift */; }; + D80C99092B0D150A0052F311 /* Sentry.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 630853322440C44F00DDE4CE /* Sentry.framework */; }; D80D021329EE93630084393D /* ErrorsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D80D021229EE93630084393D /* ErrorsViewController.swift */; }; D80D021A29EE936F0084393D /* ExtraViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D80D021929EE936F0084393D /* ExtraViewController.swift */; }; D80D021B29EE9E3D0084393D /* ErrorsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D80D021229EE93630084393D /* ErrorsViewController.swift */; }; @@ -167,6 +172,13 @@ remoteGlobalIDString = 8431F00A29B284F200D8DC56; remoteInfo = SentryTestUtils; }; + D80C98F32B0D077E0052F311 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 637AFD9E243B02760034958B /* Project object */; + proxyType = 1; + remoteGlobalIDString = D80C98EE2B0D077E0052F311; + remoteInfo = "iOS-External"; + }; D8105B5B297E792200299F03 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 6308532C2440C44F00DDE4CE /* Sentry.xcodeproj */; @@ -212,6 +224,7 @@ dstSubfolderSpec = 10; files = ( D83A30D8279F159D00372D0A /* Sentry.framework in Embed Frameworks */, + D80C98F62B0D077E0052F311 /* iOS_External.framework in Embed Frameworks */, ); name = "Embed Frameworks"; runOnlyForDeploymentPostprocessing = 0; @@ -312,6 +325,9 @@ 84FB8129284001B800F3A94A /* SentryBenchmarking.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = SentryBenchmarking.mm; sourceTree = ""; }; 84FB812C2840021B00F3A94A /* iOS-Swift-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "iOS-Swift-Bridging-Header.h"; sourceTree = ""; }; 8E8C57AE25EF16E6001CEEFA /* TraceTestViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TraceTestViewController.swift; sourceTree = ""; }; + D80C98EF2B0D077E0052F311 /* iOS_External.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = iOS_External.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + D80C98F12B0D077E0052F311 /* iOS_External.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = iOS_External.h; sourceTree = ""; }; + D80C99072B0D07DA0052F311 /* ExternalViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ExternalViewController.swift; sourceTree = ""; }; D80D021229EE93630084393D /* ErrorsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ErrorsViewController.swift; sourceTree = ""; }; D80D021929EE936F0084393D /* ExtraViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ExtraViewController.swift; sourceTree = ""; }; D8269A39274C095E00BD5BD5 /* iOS13-Swift.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "iOS13-Swift.app"; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -365,6 +381,7 @@ buildActionMask = 2147483647; files = ( 630853532440C60F00DDE4CE /* Sentry.framework in Frameworks */, + D80C98F52B0D077E0052F311 /* iOS_External.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -384,6 +401,14 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + D80C98EC2B0D077E0052F311 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + D80C99092B0D150A0052F311 /* Sentry.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; D8269A36274C095E00BD5BD5 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; @@ -441,6 +466,7 @@ D840D521273A07F400CDF142 /* iOS-SwiftClip */, D8269A3A274C095E00BD5BD5 /* iOS13-Swift */, D85DAA4A274C244F004DF43C /* iOS13-SwiftTests */, + D80C98F02B0D077E0052F311 /* iOS-External */, 637AFDA7243B02760034958B /* Products */, 634C7EC124406A4200AFDE9F /* Frameworks */, ); @@ -457,6 +483,7 @@ D8269A39274C095E00BD5BD5 /* iOS13-Swift.app */, D85DAA49274C244F004DF43C /* iOS13-SwiftTests.xctest */, 848A2573286E3351008A8858 /* PerformanceBenchmarks.xctest */, + D80C98EF2B0D077E0052F311 /* iOS_External.framework */, ); name = Products; sourceTree = ""; @@ -525,6 +552,15 @@ path = Profiling; sourceTree = ""; }; + D80C98F02B0D077E0052F311 /* iOS-External */ = { + isa = PBXGroup; + children = ( + D80C98F12B0D077E0052F311 /* iOS_External.h */, + D80C99072B0D07DA0052F311 /* ExternalViewController.swift */, + ); + path = "iOS-External"; + sourceTree = ""; + }; D8269A3A274C095E00BD5BD5 /* iOS13-Swift */ = { isa = PBXGroup; children = ( @@ -620,6 +656,17 @@ }; /* End PBXGroup section */ +/* Begin PBXHeadersBuildPhase section */ + D80C98EA2B0D077E0052F311 /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + D80C98F22B0D077E0052F311 /* iOS_External.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXHeadersBuildPhase section */ + /* Begin PBXNativeTarget section */ 637AFDA5243B02760034958B /* iOS-Swift */ = { isa = PBXNativeTarget; @@ -636,6 +683,7 @@ dependencies = ( 630853522440C60800DDE4CE /* PBXTargetDependency */, D840D533273A07F600CDF142 /* PBXTargetDependency */, + D80C98F42B0D077E0052F311 /* PBXTargetDependency */, ); name = "iOS-Swift"; productName = "iOS-Swift"; @@ -682,6 +730,24 @@ productReference = 848A2573286E3351008A8858 /* PerformanceBenchmarks.xctest */; productType = "com.apple.product-type.bundle.ui-testing"; }; + D80C98EE2B0D077E0052F311 /* iOS-External */ = { + isa = PBXNativeTarget; + buildConfigurationList = D80C99002B0D077E0052F311 /* Build configuration list for PBXNativeTarget "iOS-External" */; + buildPhases = ( + D80C98EA2B0D077E0052F311 /* Headers */, + D80C98EB2B0D077E0052F311 /* Sources */, + D80C98EC2B0D077E0052F311 /* Frameworks */, + D80C98ED2B0D077E0052F311 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = "iOS-External"; + productName = "iOS-External"; + productReference = D80C98EF2B0D077E0052F311 /* iOS_External.framework */; + productType = "com.apple.product-type.framework"; + }; D8269A38274C095E00BD5BD5 /* iOS13-Swift */ = { isa = PBXNativeTarget; buildConfigurationList = D8269A4D274C096000BD5BD5 /* Build configuration list for PBXNativeTarget "iOS13-Swift" */; @@ -757,6 +823,10 @@ LastSwiftMigration = 1340; TestTargetID = 637AFDA5243B02760034958B; }; + D80C98EE2B0D077E0052F311 = { + CreatedOnToolsVersion = 15.0.1; + LastSwiftMigration = 1500; + }; D8269A38274C095E00BD5BD5 = { CreatedOnToolsVersion = 13.1; }; @@ -794,6 +864,7 @@ D840D51F273A07F400CDF142 /* iOS-SwiftClip */, D8269A38274C095E00BD5BD5 /* iOS13-Swift */, D85DAA48274C244F004DF43C /* iOS13-SwiftTests */, + D80C98EE2B0D077E0052F311 /* iOS-External */, ); }; /* End PBXProject section */ @@ -873,6 +944,13 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + D80C98ED2B0D077E0052F311 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; D8269A37274C095E00BD5BD5 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; @@ -969,6 +1047,14 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + D80C98EB2B0D077E0052F311 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + D80C99082B0D07DA0052F311 /* ExternalViewController.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; D8269A35274C095E00BD5BD5 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; @@ -1042,6 +1128,11 @@ target = 637AFDA5243B02760034958B /* iOS-Swift */; targetProxy = 848A2564286E3351008A8858 /* PBXContainerItemProxy */; }; + D80C98F42B0D077E0052F311 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = D80C98EE2B0D077E0052F311 /* iOS-External */; + targetProxy = D80C98F32B0D077E0052F311 /* PBXContainerItemProxy */; + }; D83A30CB279F075800372D0A /* PBXTargetDependency */ = { isa = PBXTargetDependency; name = Sentry; @@ -1823,6 +1914,176 @@ }; name = TestCI; }; + D80C98F72B0D077E0052F311 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; + CLANG_ENABLE_MODULES = YES; + CODE_SIGN_IDENTITY = "iPhone Developer"; + "CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development"; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + DEFINES_MODULE = YES; + DEVELOPMENT_TEAM = 97JCY7859U; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + ENABLE_MODULE_VERIFIER = YES; + ENABLE_USER_SCRIPT_SANDBOXING = YES; + GCC_C_LANGUAGE_STANDARD = gnu17; + GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_KEY_NSHumanReadableCopyright = "Copyright © 2023 Sentry. All rights reserved."; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 17.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + LOCALIZATION_PREFERS_STRING_CATALOGS = YES; + MARKETING_VERSION = 1.0; + MODULE_VERIFIER_SUPPORTED_LANGUAGES = "objective-c objective-c++"; + MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu17 gnu++20"; + PRODUCT_BUNDLE_IDENTIFIER = "io.sentry.iOS-External"; + PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; + SKIP_INSTALL = YES; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = "DEBUG $(inherited)"; + SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Debug; + }; + D80C98F82B0D077E0052F311 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; + CLANG_ENABLE_MODULES = YES; + CODE_SIGN_IDENTITY = "iPhone Distribution"; + "CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Distribution"; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + DEFINES_MODULE = YES; + DEVELOPMENT_TEAM = 97JCY7859U; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + ENABLE_MODULE_VERIFIER = YES; + ENABLE_USER_SCRIPT_SANDBOXING = YES; + GCC_C_LANGUAGE_STANDARD = gnu17; + GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_KEY_NSHumanReadableCopyright = "Copyright © 2023 Sentry. All rights reserved."; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 17.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + LOCALIZATION_PREFERS_STRING_CATALOGS = YES; + MARKETING_VERSION = 1.0; + MODULE_VERIFIER_SUPPORTED_LANGUAGES = "objective-c objective-c++"; + MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu17 gnu++20"; + PRODUCT_BUNDLE_IDENTIFIER = "io.sentry.iOS-External"; + PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; + SKIP_INSTALL = YES; + SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Release; + }; + D80C98F92B0D077E0052F311 /* TestCI */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; + CLANG_ENABLE_MODULES = YES; + CODE_SIGN_IDENTITY = "iPhone Developer"; + "CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development"; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + DEFINES_MODULE = YES; + DEVELOPMENT_TEAM = 97JCY7859U; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + ENABLE_MODULE_VERIFIER = YES; + ENABLE_USER_SCRIPT_SANDBOXING = YES; + GCC_C_LANGUAGE_STANDARD = gnu17; + GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_KEY_NSHumanReadableCopyright = "Copyright © 2023 Sentry. All rights reserved."; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 17.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + LOCALIZATION_PREFERS_STRING_CATALOGS = YES; + MARKETING_VERSION = 1.0; + MODULE_VERIFIER_SUPPORTED_LANGUAGES = "objective-c objective-c++"; + MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu17 gnu++20"; + PRODUCT_BUNDLE_IDENTIFIER = "io.sentry.iOS-External"; + PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; + SKIP_INSTALL = YES; + SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = TestCI; + }; + D80C98FA2B0D077E0052F311 /* Test */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; + CLANG_ENABLE_MODULES = YES; + CODE_SIGN_IDENTITY = "iPhone Developer"; + "CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development"; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + DEFINES_MODULE = YES; + DEVELOPMENT_TEAM = 97JCY7859U; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + ENABLE_MODULE_VERIFIER = YES; + ENABLE_USER_SCRIPT_SANDBOXING = YES; + GCC_C_LANGUAGE_STANDARD = gnu17; + GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_KEY_NSHumanReadableCopyright = "Copyright © 2023 Sentry. All rights reserved."; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 17.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + LOCALIZATION_PREFERS_STRING_CATALOGS = YES; + MARKETING_VERSION = 1.0; + MODULE_VERIFIER_SUPPORTED_LANGUAGES = "objective-c objective-c++"; + MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu17 gnu++20"; + PRODUCT_BUNDLE_IDENTIFIER = "io.sentry.iOS-External"; + PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; + SKIP_INSTALL = YES; + SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Test; + }; D8269A4A274C096000BD5BD5 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { @@ -2048,6 +2309,17 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; + D80C99002B0D077E0052F311 /* Build configuration list for PBXNativeTarget "iOS-External" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + D80C98F72B0D077E0052F311 /* Debug */, + D80C98F82B0D077E0052F311 /* Release */, + D80C98F92B0D077E0052F311 /* TestCI */, + D80C98FA2B0D077E0052F311 /* Test */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; D8269A4D274C096000BD5BD5 /* Build configuration list for PBXNativeTarget "iOS13-Swift" */ = { isa = XCConfigurationList; buildConfigurations = ( diff --git a/Samples/iOS-Swift/iOS-Swift/AppDelegate.swift b/Samples/iOS-Swift/iOS-Swift/AppDelegate.swift index c355508fdc6..cc03cd4b789 100644 --- a/Samples/iOS-Swift/iOS-Swift/AppDelegate.swift +++ b/Samples/iOS-Swift/iOS-Swift/AppDelegate.swift @@ -31,6 +31,8 @@ class AppDelegate: UIResponder, UIApplicationDelegate { options.attachViewHierarchy = true options.environment = "test-app" options.enableTimeToFullDisplayTracing = true + + options.add(inAppInclude: "iOS_External") let isBenchmarking = ProcessInfo.processInfo.arguments.contains("--io.sentry.test.benchmarking") diff --git a/Samples/iOS-Swift/iOS-Swift/Base.lproj/Main.storyboard b/Samples/iOS-Swift/iOS-Swift/Base.lproj/Main.storyboard index b2806e76ae1..f633d238803 100644 --- a/Samples/iOS-Swift/iOS-Swift/Base.lproj/Main.storyboard +++ b/Samples/iOS-Swift/iOS-Swift/Base.lproj/Main.storyboard @@ -19,7 +19,7 @@ - + + @@ -377,6 +386,22 @@ + + + + + + + + + + + + + + + + diff --git a/Sentry.xcodeproj/project.pbxproj b/Sentry.xcodeproj/project.pbxproj index e09ce7ccef2..9548b5064f1 100644 --- a/Sentry.xcodeproj/project.pbxproj +++ b/Sentry.xcodeproj/project.pbxproj @@ -733,6 +733,7 @@ D808FB88281AB33C009A2A33 /* SentryUIEventTrackerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D808FB86281AB31D009A2A33 /* SentryUIEventTrackerTests.swift */; }; D808FB8B281BCE96009A2A33 /* TestSentrySwizzleWrapper.swift in Sources */ = {isa = PBXBuildFile; fileRef = D808FB89281BCE46009A2A33 /* TestSentrySwizzleWrapper.swift */; }; D808FB92281BF6EC009A2A33 /* SentryUIEventTrackingIntegrationTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D808FB90281BF6E9009A2A33 /* SentryUIEventTrackingIntegrationTests.swift */; }; + D80C990B2B0DFE410052F311 /* ExternalUIViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D80C990A2B0DFE410052F311 /* ExternalUIViewController.swift */; }; D8137D54272B53070082656C /* TestSentrySpan.m in Sources */ = {isa = PBXBuildFile; fileRef = D8137D53272B53070082656C /* TestSentrySpan.m */; }; D8199DBE29376EDE0074249E /* SentryInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = D8199DB829376ECC0074249E /* SentryInternal.h */; }; D8199DBF29376EE20074249E /* SentryInternal.m in Sources */ = {isa = PBXBuildFile; fileRef = D8199DB929376ECC0074249E /* SentryInternal.m */; }; @@ -1676,6 +1677,7 @@ D808FB86281AB31D009A2A33 /* SentryUIEventTrackerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryUIEventTrackerTests.swift; sourceTree = ""; }; D808FB89281BCE46009A2A33 /* TestSentrySwizzleWrapper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TestSentrySwizzleWrapper.swift; sourceTree = ""; }; D808FB90281BF6E9009A2A33 /* SentryUIEventTrackingIntegrationTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryUIEventTrackingIntegrationTests.swift; sourceTree = ""; }; + D80C990A2B0DFE410052F311 /* ExternalUIViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ExternalUIViewController.swift; sourceTree = ""; }; D8105B8D297FD16800299F03 /* SentryPerformanceTracker+Testing.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "SentryPerformanceTracker+Testing.h"; sourceTree = ""; }; D8137D52272B53070082656C /* TestSentrySpan.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = TestSentrySpan.h; sourceTree = ""; }; D8137D53272B53070082656C /* TestSentrySpan.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = TestSentrySpan.m; sourceTree = ""; }; @@ -3199,6 +3201,7 @@ 844EDC7829415AB300C86F34 /* TestSentrySystemWrapper.swift */, 844EDCE72947DCD700C86F34 /* TestSentryNSTimerFactory.swift */, 84B7FA3B29B2866200AD93B1 /* SentryTestUtils-ObjC-BridgingHeader.h */, + D80C990A2B0DFE410052F311 /* ExternalUIViewController.swift */, ); path = SentryTestUtils; sourceTree = ""; @@ -4489,6 +4492,7 @@ 84AC61DB29F7654A009EEF61 /* TestDispatchSourceWrapper.swift in Sources */, 8431F01729B2851500D8DC56 /* TestSentrySystemWrapper.swift in Sources */, 84281C632A579D0700EE88F2 /* SentryProfilerMocks.mm in Sources */, + D80C990B2B0DFE410052F311 /* ExternalUIViewController.swift in Sources */, 84B7FA4129B28CD200AD93B1 /* TestSentryDispatchQueueWrapper.swift in Sources */, 84B7FA3E29B28ADD00AD93B1 /* TestClient.swift in Sources */, ); @@ -5219,7 +5223,7 @@ DEVELOPMENT_TEAM = ""; EXECUTABLE_PREFIX = lib; GCC_C_LANGUAGE_STANDARD = gnu99; - MACH_O_TYPE = staticlib; + MACH_O_TYPE = mh_dylib; MTL_ENABLE_DEBUG_INFO = YES; MTL_FAST_MATH = YES; PRODUCT_BUNDLE_IDENTIFIER = io.sentry.SentryTestUtils; @@ -5373,7 +5377,7 @@ DEVELOPMENT_TEAM = ""; EXECUTABLE_PREFIX = lib; GCC_C_LANGUAGE_STANDARD = gnu99; - MACH_O_TYPE = staticlib; + MACH_O_TYPE = mh_dylib; MTL_ENABLE_DEBUG_INFO = YES; MTL_FAST_MATH = YES; PRODUCT_BUNDLE_IDENTIFIER = io.sentry.SentryTestUtils; @@ -5404,7 +5408,7 @@ DEVELOPMENT_TEAM = ""; EXECUTABLE_PREFIX = lib; GCC_C_LANGUAGE_STANDARD = gnu99; - MACH_O_TYPE = staticlib; + MACH_O_TYPE = mh_dylib; MTL_FAST_MATH = YES; PRODUCT_BUNDLE_IDENTIFIER = io.sentry.SentryTestUtils; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -5434,7 +5438,7 @@ DEVELOPMENT_TEAM = ""; EXECUTABLE_PREFIX = lib; GCC_C_LANGUAGE_STANDARD = gnu99; - MACH_O_TYPE = staticlib; + MACH_O_TYPE = mh_dylib; MTL_FAST_MATH = YES; PRODUCT_BUNDLE_IDENTIFIER = io.sentry.SentryTestUtils; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -5464,7 +5468,7 @@ DEVELOPMENT_TEAM = ""; EXECUTABLE_PREFIX = lib; GCC_C_LANGUAGE_STANDARD = gnu99; - MACH_O_TYPE = staticlib; + MACH_O_TYPE = mh_dylib; MTL_FAST_MATH = YES; PRODUCT_BUNDLE_IDENTIFIER = io.sentry.SentryTestUtils; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -5724,7 +5728,7 @@ DEVELOPMENT_TEAM = ""; EXECUTABLE_PREFIX = lib; GCC_C_LANGUAGE_STANDARD = gnu99; - MACH_O_TYPE = staticlib; + MACH_O_TYPE = mh_dylib; MTL_FAST_MATH = YES; PRODUCT_BUNDLE_IDENTIFIER = io.sentry.SentryTestUtils; PRODUCT_NAME = "$(TARGET_NAME)"; diff --git a/SentryTestUtils/ExternalUIViewController.swift b/SentryTestUtils/ExternalUIViewController.swift new file mode 100644 index 00000000000..00005f4fd04 --- /dev/null +++ b/SentryTestUtils/ExternalUIViewController.swift @@ -0,0 +1,10 @@ +import Foundation + +#if os(iOS) || os(tvOS) +import UIKit + +//This class is used to test swizzling of view controllers in external libs +public class ExternalUIViewController: UIViewController { +} + +#endif diff --git a/Sources/Sentry/SentryBinaryImageCache.m b/Sources/Sentry/SentryBinaryImageCache.m index e98b4374bde..3bfd6be81b2 100644 --- a/Sources/Sentry/SentryBinaryImageCache.m +++ b/Sources/Sentry/SentryBinaryImageCache.m @@ -99,6 +99,19 @@ - (NSInteger)indexOfImage:(uint64_t)address return -1; // Address not found } +- (nullable NSString *)pathForImage:(NSString *)binaryName +{ + @synchronized(self) { + for (SentryBinaryImageInfo *info in _cache) { + if ([[info.name.lastPathComponent lowercaseString] + isEqualToString:binaryName.lowercaseString]) { + return info.name; + } + } + } + return nil; +} + @end static void diff --git a/Sources/Sentry/SentryInAppLogic.m b/Sources/Sentry/SentryInAppLogic.m index 1c382e627c8..251a6a121e9 100644 --- a/Sources/Sentry/SentryInAppLogic.m +++ b/Sources/Sentry/SentryInAppLogic.m @@ -4,14 +4,6 @@ NS_ASSUME_NONNULL_BEGIN -@interface -SentryInAppLogic () - -@property (nonatomic, copy, readonly) NSArray *inAppIncludes; -@property (nonatomic, copy, readonly) NSArray *inAppExcludes; - -@end - @implementation SentryInAppLogic - (instancetype)initWithInAppIncludes:(NSArray *)inAppIncludes diff --git a/Sources/Sentry/SentrySDK.m b/Sources/Sentry/SentrySDK.m index aae81f632c1..2840b439a1b 100644 --- a/Sources/Sentry/SentrySDK.m +++ b/Sources/Sentry/SentrySDK.m @@ -160,10 +160,11 @@ + (void)startWithOptions:(SentryOptions *)options SENTRY_LOG_DEBUG(@"Dispatching init work required to run on main thread."); [SentryThreadWrapper onMainThread:^{ SENTRY_LOG_DEBUG(@"SDK main thread init started..."); - [SentrySDK installIntegrations]; [SentryCrashWrapper.sharedInstance startBinaryImageCache]; [SentryDependencyContainer.sharedInstance.binaryImageCache start]; + + [SentrySDK installIntegrations]; #if TARGET_OS_IOS && SENTRY_HAS_UIKIT [SentryDependencyContainer.sharedInstance.uiDeviceWrapper start]; #endif // TARGET_OS_IOS && SENTRY_HAS_UIKIT diff --git a/Sources/Sentry/SentryUIViewControllerSwizzling.m b/Sources/Sentry/SentryUIViewControllerSwizzling.m index d67e9f5a99c..46232448c03 100644 --- a/Sources/Sentry/SentryUIViewControllerSwizzling.m +++ b/Sources/Sentry/SentryUIViewControllerSwizzling.m @@ -2,8 +2,10 @@ #if SENTRY_HAS_UIKIT +# import "SentryBinaryImageCache.h" # import "SentryDefaultObjCRuntimeWrapper.h" # import "SentryDefines.h" +# import "SentryDependencyContainer.h" # import "SentryLog.h" # import "SentryNSProcessInfoWrapper.h" # import "SentrySubClassFinder.h" @@ -69,6 +71,15 @@ - (instancetype)initWithOptions:(SentryOptions *)options - (void)start { + SentryBinaryImageCache *imageCache = SentryDependencyContainer.sharedInstance.binaryImageCache; + + for (NSString *string in self.inAppLogic.inAppIncludes) { + NSString *pathToImage = [imageCache pathForImage:string]; + if (pathToImage != nil) { + [self swizzleUIViewControllersOfImage:pathToImage]; + } + } + id app = [self findApp]; if (app != nil) { @@ -95,19 +106,6 @@ - (void)start @"a rootViewController"); } } - - [self swizzleAllSubViewControllersInApp:app]; - } else { - // If we can't find an UIApplication instance we may use the current process path as the - // image name. This mostly happens with SwiftUI projects. - NSString *processImage = self.processInfoWrapper.processPath; - if (processImage) { - [self swizzleUIViewControllersOfImage:processImage]; - } else { - SENTRY_LOG_DEBUG( - @"UIViewControllerSwizzling: Did not found image name from current process. " - @"Skipping Swizzling of view controllers"); - } } [self swizzleUIViewController]; diff --git a/Sources/Sentry/include/HybridPublic/SentryBinaryImageCache.h b/Sources/Sentry/include/HybridPublic/SentryBinaryImageCache.h index 70ea8be25d9..49bb77c6f2b 100644 --- a/Sources/Sentry/include/HybridPublic/SentryBinaryImageCache.h +++ b/Sources/Sentry/include/HybridPublic/SentryBinaryImageCache.h @@ -21,6 +21,8 @@ NS_ASSUME_NONNULL_BEGIN - (nullable SentryBinaryImageInfo *)imageByAddress:(const uint64_t)address; +- (nullable NSString *)pathForImage:(NSString *)binaryName; + @end NS_ASSUME_NONNULL_END diff --git a/Sources/Sentry/include/SentryInAppLogic.h b/Sources/Sentry/include/SentryInAppLogic.h index 9afa5a1b8f1..2ee51236dd5 100644 --- a/Sources/Sentry/include/SentryInAppLogic.h +++ b/Sources/Sentry/include/SentryInAppLogic.h @@ -30,6 +30,10 @@ NS_ASSUME_NONNULL_BEGIN @interface SentryInAppLogic : NSObject SENTRY_NO_INIT +@property (nonnull, readonly) NSArray *inAppIncludes; + +@property (nonnull, readonly) NSArray *inAppExcludes; + /** * Initializes @c SentryInAppLogic with @c inAppIncludes and @c inAppExcludes. * diff --git a/Tests/SentryTests/Integrations/Performance/UIViewController/SentryUIViewControllerSwizzlingTests.swift b/Tests/SentryTests/Integrations/Performance/UIViewController/SentryUIViewControllerSwizzlingTests.swift index 1b306ec7bde..fa8d4b56126 100644 --- a/Tests/SentryTests/Integrations/Performance/UIViewController/SentryUIViewControllerSwizzlingTests.swift +++ b/Tests/SentryTests/Integrations/Performance/UIViewController/SentryUIViewControllerSwizzlingTests.swift @@ -22,6 +22,12 @@ class SentryUIViewControllerSwizzlingTests: XCTestCase { cString: class_getImageName(SentryUIViewControllerSwizzlingTests.self)!, encoding: .utf8)! as NSString options.add(inAppInclude: imageName.lastPathComponent) + + let externalImageName = String( + cString: class_getImageName(ExternalUIViewController.self)!, + encoding: .utf8)! as NSString + options.add(inAppInclude: externalImageName.lastPathComponent) + return options } @@ -56,6 +62,20 @@ class SentryUIViewControllerSwizzlingTests: XCTestCase { super.tearDown() clearTestState() } + + func testExternalViewControllerImage() { + //Test to ensure ExternalUIViewController exists in an external lib + //just in case someone changes the settings of the `SentryTestUtils` lib + let imageName = String( + cString: class_getImageName(SentryUIViewControllerSwizzlingTests.self)!, + encoding: .utf8)! as NSString + + let externalImageName = String( + cString: class_getImageName(ExternalUIViewController.self)!, + encoding: .utf8)! as NSString + + XCTAssertNotEqual(externalImageName, imageName) + } func testShouldSwizzle_TestViewController() { let result = fixture.sut.shouldSwizzleViewController(TestViewController.self) @@ -123,6 +143,14 @@ class SentryUIViewControllerSwizzlingTests: XCTestCase { } } + func testSwizzlingOfExternalLibs() { + let sut = fixture.sut + sut.start() + let controller = ExternalUIViewController() + controller.loadView() + XCTAssertNotNil(SentrySDK.span) + } + func testSwizzle_fromScene_invalidNotification_NoObject() { let swizzler = fixture.testableSut From 24839d46b72733f3c42dc526940b4fba78a9e8bc Mon Sep 17 00:00:00 2001 From: Dhiogo Brustolin Date: Wed, 22 Nov 2023 10:41:25 +0100 Subject: [PATCH 02/22] Update ExternalUIViewController.swift --- SentryTestUtils/ExternalUIViewController.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SentryTestUtils/ExternalUIViewController.swift b/SentryTestUtils/ExternalUIViewController.swift index 00005f4fd04..efdb65be161 100644 --- a/SentryTestUtils/ExternalUIViewController.swift +++ b/SentryTestUtils/ExternalUIViewController.swift @@ -1,6 +1,6 @@ import Foundation -#if os(iOS) || os(tvOS) +#if os(iOS) || os(tvOS) || targetEnvironment(macCatalyst) import UIKit //This class is used to test swizzling of view controllers in external libs From c44188756552f9d557b3160cea8fc9fa0f7a5e34 Mon Sep 17 00:00:00 2001 From: Dhiogo Brustolin Date: Wed, 22 Nov 2023 10:47:19 +0100 Subject: [PATCH 03/22] Update CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0b74734f116..8eeba1d4caa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ ### Fixes - Infinite loop when parsing MetricKit data (#3395) +- Finish transaction for external view controllers (#3440) ## 8.15.2 From a236c9575f6c7bcc703ce740d85c3c7da2d64cfb Mon Sep 17 00:00:00 2001 From: Dhiogo Brustolin Date: Wed, 22 Nov 2023 10:48:34 +0100 Subject: [PATCH 04/22] Update CHANGELOG.md --- CHANGELOG.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4ee4ecbe135..42c4b67ca15 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## Unreleased + +### Fixes + +- Finish transaction for external view controllers (#3440) + ## 8.16.0 ### Features @@ -10,7 +16,6 @@ ### Fixes - Infinite loop when parsing MetricKit data (#3395) -- Finish transaction for external view controllers (#3440) - Fix incorrect implementation in #3398 to work around a profiling crash (#3405) - Fix crash in SentryFramesTracker (#3424) From a60eff53fcaa2538376cc27432fbfa999421e609 Mon Sep 17 00:00:00 2001 From: Dhiogo Brustolin Date: Wed, 22 Nov 2023 11:10:48 +0100 Subject: [PATCH 05/22] Update SentryUIViewControllerSwizzlingTests.swift --- .../SentryUIViewControllerSwizzlingTests.swift | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Tests/SentryTests/Integrations/Performance/UIViewController/SentryUIViewControllerSwizzlingTests.swift b/Tests/SentryTests/Integrations/Performance/UIViewController/SentryUIViewControllerSwizzlingTests.swift index 32f7e8341c4..fb8be02f30c 100644 --- a/Tests/SentryTests/Integrations/Performance/UIViewController/SentryUIViewControllerSwizzlingTests.swift +++ b/Tests/SentryTests/Integrations/Performance/UIViewController/SentryUIViewControllerSwizzlingTests.swift @@ -18,6 +18,7 @@ class SentryUIViewControllerSwizzlingTests: XCTestCase { var options: Options { let options = Options.noIntegrations() + let imageName = String( cString: class_getImageName(SentryUIViewControllerSwizzlingTests.self)!, encoding: .utf8)! as NSString @@ -105,7 +106,16 @@ class SentryUIViewControllerSwizzlingTests: XCTestCase { fixture.sut.start() let controller = TestViewController() controller.loadView() + let span = SentrySDK.span + + //To finish the transaction we need to finish `initialDisplay` span + //by calling `viewWillAppear` and reporting a new frame + controller.viewWillAppear(false) + Dynamic(SentryDependencyContainer.sharedInstance().framesTracker).reportNewFrame() + XCTAssertNotNil(SentrySDK.span) + controller.viewDidAppear(false) + XCTAssertTrue(span?.isFinished == true) } func testViewControllerWithLoadView_TransactionBoundToScope() { From 58708cf82d1b1f6b04f5884fdb67e7d20d19cdfd Mon Sep 17 00:00:00 2001 From: Dhiogo Brustolin Date: Wed, 22 Nov 2023 12:21:35 +0100 Subject: [PATCH 06/22] Update project.pbxproj --- .../iOS-Swift.xcodeproj/project.pbxproj | 32 ++++++++++++++----- 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/Samples/iOS-Swift/iOS-Swift.xcodeproj/project.pbxproj b/Samples/iOS-Swift/iOS-Swift.xcodeproj/project.pbxproj index 7b690c3dced..0e73840174f 100644 --- a/Samples/iOS-Swift/iOS-Swift.xcodeproj/project.pbxproj +++ b/Samples/iOS-Swift/iOS-Swift.xcodeproj/project.pbxproj @@ -47,7 +47,8 @@ D80C98F52B0D077E0052F311 /* iOS_External.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D80C98EF2B0D077E0052F311 /* iOS_External.framework */; }; D80C98F62B0D077E0052F311 /* iOS_External.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = D80C98EF2B0D077E0052F311 /* iOS_External.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; D80C99082B0D07DA0052F311 /* ExternalViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D80C99072B0D07DA0052F311 /* ExternalViewController.swift */; }; - D80C99092B0D150A0052F311 /* Sentry.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 630853322440C44F00DDE4CE /* Sentry.framework */; }; + D80C991B2B0E1B820052F311 /* Sentry.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 630853322440C44F00DDE4CE /* Sentry.framework */; }; + D80C991C2B0E1B820052F311 /* Sentry.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 630853322440C44F00DDE4CE /* Sentry.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; D80D021329EE93630084393D /* ErrorsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D80D021229EE93630084393D /* ErrorsViewController.swift */; }; D80D021A29EE936F0084393D /* ExtraViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D80D021929EE936F0084393D /* ExtraViewController.swift */; }; D80D021B29EE9E3D0084393D /* ErrorsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D80D021229EE93630084393D /* ErrorsViewController.swift */; }; @@ -253,6 +254,17 @@ name = "Embed Frameworks"; runOnlyForDeploymentPostprocessing = 0; }; + D80C991D2B0E1B820052F311 /* Embed Frameworks */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + D80C991C2B0E1B820052F311 /* Sentry.framework in Embed Frameworks */, + ); + name = "Embed Frameworks"; + runOnlyForDeploymentPostprocessing = 0; + }; D8269A5B274C100300BD5BD5 /* Embed Frameworks */ = { isa = PBXCopyFilesBuildPhase; buildActionMask = 2147483647; @@ -408,7 +420,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - D80C99092B0D150A0052F311 /* Sentry.framework in Frameworks */, + D80C991B2B0E1B820052F311 /* Sentry.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -742,6 +754,7 @@ D80C98EB2B0D077E0052F311 /* Sources */, D80C98EC2B0D077E0052F311 /* Frameworks */, D80C98ED2B0D077E0052F311 /* Resources */, + D80C991D2B0E1B820052F311 /* Embed Frameworks */, ); buildRules = ( ); @@ -1928,10 +1941,10 @@ CLANG_ENABLE_MODULES = YES; CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development"; - CODE_SIGN_STYLE = Automatic; + CODE_SIGN_STYLE = Manual; CURRENT_PROJECT_VERSION = 1; DEFINES_MODULE = YES; - DEVELOPMENT_TEAM = 97JCY7859U; + DEVELOPMENT_TEAM = ""; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; @@ -1953,6 +1966,7 @@ MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu17 gnu++20"; PRODUCT_BUNDLE_IDENTIFIER = "io.sentry.iOS-External"; PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; + PROVISIONING_PROFILE_SPECIFIER = ""; SKIP_INSTALL = YES; SWIFT_ACTIVE_COMPILATION_CONDITIONS = "DEBUG $(inherited)"; SWIFT_EMIT_LOC_STRINGS = YES; @@ -2014,10 +2028,10 @@ CLANG_ENABLE_MODULES = YES; CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development"; - CODE_SIGN_STYLE = Automatic; + CODE_SIGN_STYLE = Manual; CURRENT_PROJECT_VERSION = 1; DEFINES_MODULE = YES; - DEVELOPMENT_TEAM = 97JCY7859U; + DEVELOPMENT_TEAM = ""; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; @@ -2039,6 +2053,7 @@ MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu17 gnu++20"; PRODUCT_BUNDLE_IDENTIFIER = "io.sentry.iOS-External"; PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; + PROVISIONING_PROFILE_SPECIFIER = ""; SKIP_INSTALL = YES; SWIFT_EMIT_LOC_STRINGS = YES; SWIFT_VERSION = 5.0; @@ -2056,10 +2071,10 @@ CLANG_ENABLE_MODULES = YES; CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development"; - CODE_SIGN_STYLE = Automatic; + CODE_SIGN_STYLE = Manual; CURRENT_PROJECT_VERSION = 1; DEFINES_MODULE = YES; - DEVELOPMENT_TEAM = 97JCY7859U; + DEVELOPMENT_TEAM = ""; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; @@ -2081,6 +2096,7 @@ MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu17 gnu++20"; PRODUCT_BUNDLE_IDENTIFIER = "io.sentry.iOS-External"; PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; + PROVISIONING_PROFILE_SPECIFIER = ""; SKIP_INSTALL = YES; SWIFT_EMIT_LOC_STRINGS = YES; SWIFT_VERSION = 5.0; From ce79a002c3860a5d32621cbc7843df5f5071a015 Mon Sep 17 00:00:00 2001 From: Dhiogo Brustolin Date: Wed, 22 Nov 2023 12:32:33 +0100 Subject: [PATCH 07/22] Update project.pbxproj --- .../iOS-Swift/iOS-Swift.xcodeproj/project.pbxproj | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/Samples/iOS-Swift/iOS-Swift.xcodeproj/project.pbxproj b/Samples/iOS-Swift/iOS-Swift.xcodeproj/project.pbxproj index 0e73840174f..2aa148785f6 100644 --- a/Samples/iOS-Swift/iOS-Swift.xcodeproj/project.pbxproj +++ b/Samples/iOS-Swift/iOS-Swift.xcodeproj/project.pbxproj @@ -1954,7 +1954,7 @@ GENERATE_INFOPLIST_FILE = YES; INFOPLIST_KEY_NSHumanReadableCopyright = "Copyright © 2023 Sentry. All rights reserved."; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 17.0; + IPHONEOS_DEPLOYMENT_TARGET = 14.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -1986,10 +1986,10 @@ CLANG_ENABLE_MODULES = YES; CODE_SIGN_IDENTITY = "iPhone Distribution"; "CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Distribution"; - CODE_SIGN_STYLE = Automatic; + CODE_SIGN_STYLE = Manual; CURRENT_PROJECT_VERSION = 1; DEFINES_MODULE = YES; - DEVELOPMENT_TEAM = 97JCY7859U; + DEVELOPMENT_TEAM = ""; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; @@ -1999,7 +1999,7 @@ GENERATE_INFOPLIST_FILE = YES; INFOPLIST_KEY_NSHumanReadableCopyright = "Copyright © 2023 Sentry. All rights reserved."; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 17.0; + IPHONEOS_DEPLOYMENT_TARGET = 14.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -2011,6 +2011,7 @@ MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu17 gnu++20"; PRODUCT_BUNDLE_IDENTIFIER = "io.sentry.iOS-External"; PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; + PROVISIONING_PROFILE_SPECIFIER = ""; SKIP_INSTALL = YES; SWIFT_EMIT_LOC_STRINGS = YES; SWIFT_VERSION = 5.0; @@ -2041,7 +2042,7 @@ GENERATE_INFOPLIST_FILE = YES; INFOPLIST_KEY_NSHumanReadableCopyright = "Copyright © 2023 Sentry. All rights reserved."; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 17.0; + IPHONEOS_DEPLOYMENT_TARGET = 14.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -2084,7 +2085,7 @@ GENERATE_INFOPLIST_FILE = YES; INFOPLIST_KEY_NSHumanReadableCopyright = "Copyright © 2023 Sentry. All rights reserved."; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 17.0; + IPHONEOS_DEPLOYMENT_TARGET = 14.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", From cd449adc1e505410d1d45c34f5cb30f6fa47c4de Mon Sep 17 00:00:00 2001 From: Dhiogo Brustolin Date: Wed, 22 Nov 2023 12:47:02 +0100 Subject: [PATCH 08/22] Update no-changes-in-high-risk-files.sh --- scripts/no-changes-in-high-risk-files.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/no-changes-in-high-risk-files.sh b/scripts/no-changes-in-high-risk-files.sh index 85850687f91..ae064edbeea 100755 --- a/scripts/no-changes-in-high-risk-files.sh +++ b/scripts/no-changes-in-high-risk-files.sh @@ -6,7 +6,7 @@ set -euo pipefail ACTUAL=$(shasum -a 256 ./Sources/Sentry/SentryNSURLSessionTaskSearch.m ./Sources/Sentry/SentryNetworkTracker.m ./Sources/Sentry/SentryUIViewControllerSwizzling.m ./Sources/Sentry/SentryNSDataSwizzling.m ./Sources/Sentry/SentrySubClassFinder.m ./Sources/Sentry/SentryCoreDataSwizzling.m ./Sources/Sentry/SentrySwizzleWrapper.m ./Sources/Sentry/include/SentrySwizzle.h ./Sources/Sentry/SentrySwizzle.m) EXPECTED="819d5ca5e3db2ac23c859b14c149b7f0754d3ae88bea1dba92c18f49a81da0e1 ./Sources/Sentry/SentryNSURLSessionTaskSearch.m 2f9ea6984ff32b53fc03c386b648f4f1bdf8737ce69050d25ce6d1307f8d1672 ./Sources/Sentry/SentryNetworkTracker.m -132a491c706bdb68b47c2e0a14aeaa5c611664f34156565dbfc874b360d6a742 ./Sources/Sentry/SentryUIViewControllerSwizzling.m +7547d46b8bca0cef9d0d32f28d2b781cfe749aa942cc96a98a09aed084224014 ./Sources/Sentry/SentryUIViewControllerSwizzling.m e95e62ec7363984f20c78643bb7d992a41a740f97e1befb71525ac34caf88b37 ./Sources/Sentry/SentryNSDataSwizzling.m cc3849725bd1733515c71742872bed94ca47d2c115ef9d8c98383eae2e171925 ./Sources/Sentry/SentrySubClassFinder.m 59db11da66e6ac0058526be0be08b57cdccd3727033e85164a631b205e972134 ./Sources/Sentry/SentryCoreDataSwizzling.m From bfbf299c66d2530596ed13797c1de4e091187438 Mon Sep 17 00:00:00 2001 From: Dhiogo Brustolin Date: Thu, 23 Nov 2023 12:20:15 +0100 Subject: [PATCH 09/22] refs --- .../SentryPerformanceTrackingIntegration.m | 5 +- .../Sentry/SentryUIViewControllerSwizzling.m | 22 +++----- .../include/SentryUIViewControllerSwizzling.h | 5 +- ...SentryUIViewControllerSwizzlingTests.swift | 52 +++---------------- .../SentryBinaryImageCacheTests.swift | 12 +++++ 5 files changed, 32 insertions(+), 64 deletions(-) diff --git a/Sources/Sentry/SentryPerformanceTrackingIntegration.m b/Sources/Sentry/SentryPerformanceTrackingIntegration.m index ae5ea0c2fe8..d202566da0f 100644 --- a/Sources/Sentry/SentryPerformanceTrackingIntegration.m +++ b/Sources/Sentry/SentryPerformanceTrackingIntegration.m @@ -41,8 +41,9 @@ - (BOOL)installWithOptions:(SentryOptions *)options dispatchQueue:dispatchQueue objcRuntimeWrapper:[SentryDefaultObjCRuntimeWrapper sharedInstance] subClassFinder:subClassFinder - processInfoWrapper:[SentryDependencyContainer.sharedInstance processInfoWrapper]]; - + processInfoWrapper:[SentryDependencyContainer.sharedInstance processInfoWrapper] + binaryImageCache:[SentryDependencyContainer.sharedInstance binaryImageCache]]; + [self.swizzling start]; SentryUIViewControllerPerformanceTracker.shared.enableWaitForFullDisplay = options.enableTimeToFullDisplayTracing; diff --git a/Sources/Sentry/SentryUIViewControllerSwizzling.m b/Sources/Sentry/SentryUIViewControllerSwizzling.m index 46232448c03..bac70f892aa 100644 --- a/Sources/Sentry/SentryUIViewControllerSwizzling.m +++ b/Sources/Sentry/SentryUIViewControllerSwizzling.m @@ -40,6 +40,7 @@ @property (nonatomic, strong) SentrySubClassFinder *subClassFinder; @property (nonatomic, strong) NSMutableSet *imagesActedOnSubclassesOfUIViewControllers; @property (nonatomic, strong) SentryNSProcessInfoWrapper *processInfoWrapper; +@property (nonatomic, strong) SentryBinaryImageCache *binaryImageCache; @end @@ -50,6 +51,7 @@ - (instancetype)initWithOptions:(SentryOptions *)options objcRuntimeWrapper:(id)objcRuntimeWrapper subClassFinder:(SentrySubClassFinder *)subClassFinder processInfoWrapper:(SentryNSProcessInfoWrapper *)processInfoWrapper + binaryImageCache:(SentryBinaryImageCache *)binaryImageCache { if (self = [super init]) { self.inAppLogic = [[SentryInAppLogic alloc] initWithInAppIncludes:options.inAppIncludes @@ -59,6 +61,7 @@ - (instancetype)initWithOptions:(SentryOptions *)options self.subClassFinder = subClassFinder; self.imagesActedOnSubclassesOfUIViewControllers = [NSMutableSet new]; self.processInfoWrapper = processInfoWrapper; + self.binaryImageCache = binaryImageCache; } return self; @@ -71,12 +74,12 @@ - (instancetype)initWithOptions:(SentryOptions *)options - (void)start { - SentryBinaryImageCache *imageCache = SentryDependencyContainer.sharedInstance.binaryImageCache; - - for (NSString *string in self.inAppLogic.inAppIncludes) { - NSString *pathToImage = [imageCache pathForImage:string]; + for (NSString *include in self.inAppLogic.inAppIncludes) { + NSString *pathToImage = [self.binaryImageCache pathForImage:include]; if (pathToImage != nil) { [self swizzleUIViewControllersOfImage:pathToImage]; + } else { + SENTRY_LOG_DEBUG(@"UIViewControllerSwizzling: Failed to find binary image for %@ module.", include); } } @@ -130,17 +133,6 @@ - (void)start return app; } -- (void)swizzleAllSubViewControllersInApp:(id)app -{ - if (app.delegate == nil) { - SENTRY_LOG_DEBUG(@"UIViewControllerSwizzling: App delegate is nil. Skipping swizzling " - @"UIViewControllers in the app image."); - return; - } - - [self swizzleUIViewControllersOfClassesInImageOf:[app.delegate class]]; -} - - (void)swizzleUIViewControllersOfClassesInImageOf:(Class)class { if (class == NULL) { diff --git a/Sources/Sentry/include/SentryUIViewControllerSwizzling.h b/Sources/Sentry/include/SentryUIViewControllerSwizzling.h index dedf2fa5c35..242211441b6 100644 --- a/Sources/Sentry/include/SentryUIViewControllerSwizzling.h +++ b/Sources/Sentry/include/SentryUIViewControllerSwizzling.h @@ -7,7 +7,7 @@ NS_ASSUME_NONNULL_BEGIN -@class SentryOptions, SentryDispatchQueueWrapper, SentrySubClassFinder, SentryNSProcessInfoWrapper; +@class SentryOptions, SentryDispatchQueueWrapper, SentrySubClassFinder, SentryNSProcessInfoWrapper, SentryBinaryImageCache; /** * This is a protocol to define which properties and methods the swizzler required from @@ -30,7 +30,8 @@ SENTRY_NO_INIT dispatchQueue:(SentryDispatchQueueWrapper *)dispatchQueue objcRuntimeWrapper:(id)objcRuntimeWrapper subClassFinder:(SentrySubClassFinder *)subClassFinder - processInfoWrapper:(SentryNSProcessInfoWrapper *)processInfoWrapper; + processInfoWrapper:(SentryNSProcessInfoWrapper *)processInfoWrapper + binaryImageCache:(SentryBinaryImageCache *)binaryImageCache; - (void)start; diff --git a/Tests/SentryTests/Integrations/Performance/UIViewController/SentryUIViewControllerSwizzlingTests.swift b/Tests/SentryTests/Integrations/Performance/UIViewController/SentryUIViewControllerSwizzlingTests.swift index fb8be02f30c..2bb130aecf1 100644 --- a/Tests/SentryTests/Integrations/Performance/UIViewController/SentryUIViewControllerSwizzlingTests.swift +++ b/Tests/SentryTests/Integrations/Performance/UIViewController/SentryUIViewControllerSwizzlingTests.swift @@ -11,11 +11,13 @@ class SentryUIViewControllerSwizzlingTests: XCTestCase { let objcRuntimeWrapper = SentryTestObjCRuntimeWrapper() let subClassFinder: TestSubClassFinder let processInfoWrapper = SentryNSProcessInfoWrapper() + let binaryImageCache : SentryBinaryImageCache init() { subClassFinder = TestSubClassFinder(dispatchQueue: dispatchQueue, objcRuntimeWrapper: objcRuntimeWrapper) + binaryImageCache = SentryDependencyContainer.sharedInstance().binaryImageCache } - + var options: Options { let options = Options.noIntegrations() @@ -33,15 +35,15 @@ class SentryUIViewControllerSwizzlingTests: XCTestCase { } var sut: SentryUIViewControllerSwizzling { - return SentryUIViewControllerSwizzling(options: options, dispatchQueue: dispatchQueue, objcRuntimeWrapper: objcRuntimeWrapper, subClassFinder: subClassFinder, processInfoWrapper: processInfoWrapper) + return SentryUIViewControllerSwizzling(options: options, dispatchQueue: dispatchQueue, objcRuntimeWrapper: objcRuntimeWrapper, subClassFinder: subClassFinder, processInfoWrapper: processInfoWrapper, binaryImageCache: binaryImageCache) } var sutWithDefaultObjCRuntimeWrapper: SentryUIViewControllerSwizzling { - return SentryUIViewControllerSwizzling(options: options, dispatchQueue: dispatchQueue, objcRuntimeWrapper: SentryDefaultObjCRuntimeWrapper.sharedInstance(), subClassFinder: subClassFinder, processInfoWrapper: processInfoWrapper) + return SentryUIViewControllerSwizzling(options: options, dispatchQueue: dispatchQueue, objcRuntimeWrapper: SentryDefaultObjCRuntimeWrapper.sharedInstance(), subClassFinder: subClassFinder, processInfoWrapper: processInfoWrapper, binaryImageCache: binaryImageCache) } var testableSut: TestSentryUIViewControllerSwizzling { - return TestSentryUIViewControllerSwizzling(options: options, dispatchQueue: dispatchQueue, objcRuntimeWrapper: objcRuntimeWrapper, subClassFinder: subClassFinder, processInfoWrapper: processInfoWrapper) + return TestSentryUIViewControllerSwizzling(options: options, dispatchQueue: dispatchQueue, objcRuntimeWrapper: objcRuntimeWrapper, subClassFinder: subClassFinder, processInfoWrapper: processInfoWrapper, binaryImageCache: binaryImageCache) } var delegate: MockApplication.MockApplicationDelegate { @@ -75,7 +77,7 @@ class SentryUIViewControllerSwizzlingTests: XCTestCase { cString: class_getImageName(ExternalUIViewController.self)!, encoding: .utf8)! as NSString - XCTAssertNotEqual(externalImageName, imageName) + XCTAssertNotEqual(externalImageName, imageName, "ExternalUIViewController is not in an external library.") } func testShouldSwizzle_TestViewController() { @@ -228,46 +230,6 @@ class SentryUIViewControllerSwizzlingTests: XCTestCase { XCTAssertTrue(fixture.sut.swizzleRootViewController(from: MockApplication(delegate))) } - func testSwizzleSubViewControllers_ImageNameIsNULL_NotCalled() { - let imageName = UnsafeMutablePointer(nil) - fixture.objcRuntimeWrapper.imageName = UnsafePointer(imageName) - - // We must keep one strong reference to the delegate. The mock has only a weak. - let delegate = fixture.delegate - fixture.sut.swizzleAllSubViewControllers(inApp: MockApplication(delegate)) - - XCTAssertEqual(0, fixture.subClassFinder.invocations.count) - } - - func testSwizzleSubViewControllers_ImageName_Called() { - let imageName = "imageName" - let bytes: [CChar] = imageName.cString(using: .ascii)! - let pointer = UnsafeMutablePointer.allocate(capacity: bytes.count) - pointer.initialize(from: bytes, count: bytes.count) - fixture.objcRuntimeWrapper.imageName = UnsafePointer(pointer) - - // We must keep one strong reference to the delegate. The mock has only a weak. - let delegate = fixture.delegate - fixture.sut.swizzleAllSubViewControllers(inApp: MockApplication(delegate)) - - XCTAssertEqual(1, fixture.subClassFinder.invocations.count) - - XCTAssertEqual(imageName, fixture.subClassFinder.invocations.first?.imageName) - } - - func testSwizzleSubViewControllers_ImageNameIsGarbage_NotCalled() { - let bytes: [CChar] = [0, 2, 3, 4] - let pointer = UnsafeMutablePointer.allocate(capacity: bytes.count) - pointer.initialize(from: bytes, count: bytes.count) - fixture.objcRuntimeWrapper.imageName = UnsafePointer(pointer) - - // We must keep one strong reference to the delegate. The mock has only a weak. - let delegate = fixture.delegate - fixture.sut.swizzleAllSubViewControllers(inApp: MockApplication(delegate)) - - XCTAssertEqual(0, fixture.subClassFinder.invocations.count) - } - func testSwizzleUIViewControllersOfClassesInImageOf_ClassIsNull() { fixture.sut.swizzleUIViewControllersOfClasses(inImageOf: nil) diff --git a/Tests/SentryTests/SentryBinaryImageCacheTests.swift b/Tests/SentryTests/SentryBinaryImageCacheTests.swift index a6aa85f7965..eb055b7d139 100644 --- a/Tests/SentryTests/SentryBinaryImageCacheTests.swift +++ b/Tests/SentryTests/SentryBinaryImageCacheTests.swift @@ -1,4 +1,5 @@ import XCTest +import Nimble class SentryBinaryImageCacheTests: XCTestCase { var sut: SentryBinaryImageCache { @@ -95,6 +96,17 @@ class SentryBinaryImageCacheTests: XCTestCase { XCTAssertNil(sut.image(byAddress: 300)) XCTAssertNil(sut.image(byAddress: 399)) } + + func testImagePathByName() { + var binaryImage = createCrashBinaryImage(0) + sut.binaryImageAdded(&binaryImage) + + let path = sut.path(forImage: "Expected Name at 0") + expect(path) == "Expected Name at 0" + + let didNotFind = sut.path(forImage: "Another_Image") + expect(didNotFind) == nil + } func createCrashBinaryImage(_ address: UInt) -> SentryCrashBinaryImage { let name = "Expected Name at \(address)" From 9ef9f2dc5c3b474e4ddbc06001d79ca427b64143 Mon Sep 17 00:00:00 2001 From: Sentry Github Bot Date: Thu, 23 Nov 2023 11:30:33 +0000 Subject: [PATCH 10/22] Format code --- Sources/Sentry/SentryPerformanceTrackingIntegration.m | 2 +- Sources/Sentry/SentryUIViewControllerSwizzling.m | 3 ++- Sources/Sentry/include/SentryUIViewControllerSwizzling.h | 3 ++- .../SentryUIViewControllerSwizzlingTests.swift | 2 +- Tests/SentryTests/SentryBinaryImageCacheTests.swift | 2 +- 5 files changed, 7 insertions(+), 5 deletions(-) diff --git a/Sources/Sentry/SentryPerformanceTrackingIntegration.m b/Sources/Sentry/SentryPerformanceTrackingIntegration.m index d202566da0f..506af85ee73 100644 --- a/Sources/Sentry/SentryPerformanceTrackingIntegration.m +++ b/Sources/Sentry/SentryPerformanceTrackingIntegration.m @@ -43,7 +43,7 @@ - (BOOL)installWithOptions:(SentryOptions *)options subClassFinder:subClassFinder processInfoWrapper:[SentryDependencyContainer.sharedInstance processInfoWrapper] binaryImageCache:[SentryDependencyContainer.sharedInstance binaryImageCache]]; - + [self.swizzling start]; SentryUIViewControllerPerformanceTracker.shared.enableWaitForFullDisplay = options.enableTimeToFullDisplayTracing; diff --git a/Sources/Sentry/SentryUIViewControllerSwizzling.m b/Sources/Sentry/SentryUIViewControllerSwizzling.m index bac70f892aa..2e5970ceb75 100644 --- a/Sources/Sentry/SentryUIViewControllerSwizzling.m +++ b/Sources/Sentry/SentryUIViewControllerSwizzling.m @@ -79,7 +79,8 @@ - (void)start if (pathToImage != nil) { [self swizzleUIViewControllersOfImage:pathToImage]; } else { - SENTRY_LOG_DEBUG(@"UIViewControllerSwizzling: Failed to find binary image for %@ module.", include); + SENTRY_LOG_DEBUG( + @"UIViewControllerSwizzling: Failed to find binary image for %@ module.", include); } } diff --git a/Sources/Sentry/include/SentryUIViewControllerSwizzling.h b/Sources/Sentry/include/SentryUIViewControllerSwizzling.h index 242211441b6..510053f8b0f 100644 --- a/Sources/Sentry/include/SentryUIViewControllerSwizzling.h +++ b/Sources/Sentry/include/SentryUIViewControllerSwizzling.h @@ -7,7 +7,8 @@ NS_ASSUME_NONNULL_BEGIN -@class SentryOptions, SentryDispatchQueueWrapper, SentrySubClassFinder, SentryNSProcessInfoWrapper, SentryBinaryImageCache; +@class SentryOptions, SentryDispatchQueueWrapper, SentrySubClassFinder, SentryNSProcessInfoWrapper, + SentryBinaryImageCache; /** * This is a protocol to define which properties and methods the swizzler required from diff --git a/Tests/SentryTests/Integrations/Performance/UIViewController/SentryUIViewControllerSwizzlingTests.swift b/Tests/SentryTests/Integrations/Performance/UIViewController/SentryUIViewControllerSwizzlingTests.swift index 2bb130aecf1..35acba06412 100644 --- a/Tests/SentryTests/Integrations/Performance/UIViewController/SentryUIViewControllerSwizzlingTests.swift +++ b/Tests/SentryTests/Integrations/Performance/UIViewController/SentryUIViewControllerSwizzlingTests.swift @@ -11,7 +11,7 @@ class SentryUIViewControllerSwizzlingTests: XCTestCase { let objcRuntimeWrapper = SentryTestObjCRuntimeWrapper() let subClassFinder: TestSubClassFinder let processInfoWrapper = SentryNSProcessInfoWrapper() - let binaryImageCache : SentryBinaryImageCache + let binaryImageCache: SentryBinaryImageCache init() { subClassFinder = TestSubClassFinder(dispatchQueue: dispatchQueue, objcRuntimeWrapper: objcRuntimeWrapper) diff --git a/Tests/SentryTests/SentryBinaryImageCacheTests.swift b/Tests/SentryTests/SentryBinaryImageCacheTests.swift index eb055b7d139..285b4f218cb 100644 --- a/Tests/SentryTests/SentryBinaryImageCacheTests.swift +++ b/Tests/SentryTests/SentryBinaryImageCacheTests.swift @@ -1,5 +1,5 @@ -import XCTest import Nimble +import XCTest class SentryBinaryImageCacheTests: XCTestCase { var sut: SentryBinaryImageCache { From c0c330e9d4c16da1e03aa4df269a85c9de0fa74e Mon Sep 17 00:00:00 2001 From: Dhiogo Brustolin Date: Thu, 23 Nov 2023 13:12:28 +0100 Subject: [PATCH 11/22] lint --- Sources/Sentry/SentryPerformanceTrackingIntegration.m | 2 +- Sources/Sentry/SentryUIViewControllerSwizzling.m | 3 ++- Sources/Sentry/include/SentryUIViewControllerSwizzling.h | 3 ++- .../SentryUIViewControllerSwizzlingTests.swift | 2 +- Tests/SentryTests/SentryBinaryImageCacheTests.swift | 2 +- scripts/no-changes-in-high-risk-files.sh | 2 +- 6 files changed, 8 insertions(+), 6 deletions(-) diff --git a/Sources/Sentry/SentryPerformanceTrackingIntegration.m b/Sources/Sentry/SentryPerformanceTrackingIntegration.m index d202566da0f..506af85ee73 100644 --- a/Sources/Sentry/SentryPerformanceTrackingIntegration.m +++ b/Sources/Sentry/SentryPerformanceTrackingIntegration.m @@ -43,7 +43,7 @@ - (BOOL)installWithOptions:(SentryOptions *)options subClassFinder:subClassFinder processInfoWrapper:[SentryDependencyContainer.sharedInstance processInfoWrapper] binaryImageCache:[SentryDependencyContainer.sharedInstance binaryImageCache]]; - + [self.swizzling start]; SentryUIViewControllerPerformanceTracker.shared.enableWaitForFullDisplay = options.enableTimeToFullDisplayTracing; diff --git a/Sources/Sentry/SentryUIViewControllerSwizzling.m b/Sources/Sentry/SentryUIViewControllerSwizzling.m index bac70f892aa..2e5970ceb75 100644 --- a/Sources/Sentry/SentryUIViewControllerSwizzling.m +++ b/Sources/Sentry/SentryUIViewControllerSwizzling.m @@ -79,7 +79,8 @@ - (void)start if (pathToImage != nil) { [self swizzleUIViewControllersOfImage:pathToImage]; } else { - SENTRY_LOG_DEBUG(@"UIViewControllerSwizzling: Failed to find binary image for %@ module.", include); + SENTRY_LOG_DEBUG( + @"UIViewControllerSwizzling: Failed to find binary image for %@ module.", include); } } diff --git a/Sources/Sentry/include/SentryUIViewControllerSwizzling.h b/Sources/Sentry/include/SentryUIViewControllerSwizzling.h index 242211441b6..510053f8b0f 100644 --- a/Sources/Sentry/include/SentryUIViewControllerSwizzling.h +++ b/Sources/Sentry/include/SentryUIViewControllerSwizzling.h @@ -7,7 +7,8 @@ NS_ASSUME_NONNULL_BEGIN -@class SentryOptions, SentryDispatchQueueWrapper, SentrySubClassFinder, SentryNSProcessInfoWrapper, SentryBinaryImageCache; +@class SentryOptions, SentryDispatchQueueWrapper, SentrySubClassFinder, SentryNSProcessInfoWrapper, + SentryBinaryImageCache; /** * This is a protocol to define which properties and methods the swizzler required from diff --git a/Tests/SentryTests/Integrations/Performance/UIViewController/SentryUIViewControllerSwizzlingTests.swift b/Tests/SentryTests/Integrations/Performance/UIViewController/SentryUIViewControllerSwizzlingTests.swift index 2bb130aecf1..35acba06412 100644 --- a/Tests/SentryTests/Integrations/Performance/UIViewController/SentryUIViewControllerSwizzlingTests.swift +++ b/Tests/SentryTests/Integrations/Performance/UIViewController/SentryUIViewControllerSwizzlingTests.swift @@ -11,7 +11,7 @@ class SentryUIViewControllerSwizzlingTests: XCTestCase { let objcRuntimeWrapper = SentryTestObjCRuntimeWrapper() let subClassFinder: TestSubClassFinder let processInfoWrapper = SentryNSProcessInfoWrapper() - let binaryImageCache : SentryBinaryImageCache + let binaryImageCache: SentryBinaryImageCache init() { subClassFinder = TestSubClassFinder(dispatchQueue: dispatchQueue, objcRuntimeWrapper: objcRuntimeWrapper) diff --git a/Tests/SentryTests/SentryBinaryImageCacheTests.swift b/Tests/SentryTests/SentryBinaryImageCacheTests.swift index eb055b7d139..285b4f218cb 100644 --- a/Tests/SentryTests/SentryBinaryImageCacheTests.swift +++ b/Tests/SentryTests/SentryBinaryImageCacheTests.swift @@ -1,5 +1,5 @@ -import XCTest import Nimble +import XCTest class SentryBinaryImageCacheTests: XCTestCase { var sut: SentryBinaryImageCache { diff --git a/scripts/no-changes-in-high-risk-files.sh b/scripts/no-changes-in-high-risk-files.sh index ae064edbeea..c5d8b0dde85 100755 --- a/scripts/no-changes-in-high-risk-files.sh +++ b/scripts/no-changes-in-high-risk-files.sh @@ -6,7 +6,7 @@ set -euo pipefail ACTUAL=$(shasum -a 256 ./Sources/Sentry/SentryNSURLSessionTaskSearch.m ./Sources/Sentry/SentryNetworkTracker.m ./Sources/Sentry/SentryUIViewControllerSwizzling.m ./Sources/Sentry/SentryNSDataSwizzling.m ./Sources/Sentry/SentrySubClassFinder.m ./Sources/Sentry/SentryCoreDataSwizzling.m ./Sources/Sentry/SentrySwizzleWrapper.m ./Sources/Sentry/include/SentrySwizzle.h ./Sources/Sentry/SentrySwizzle.m) EXPECTED="819d5ca5e3db2ac23c859b14c149b7f0754d3ae88bea1dba92c18f49a81da0e1 ./Sources/Sentry/SentryNSURLSessionTaskSearch.m 2f9ea6984ff32b53fc03c386b648f4f1bdf8737ce69050d25ce6d1307f8d1672 ./Sources/Sentry/SentryNetworkTracker.m -7547d46b8bca0cef9d0d32f28d2b781cfe749aa942cc96a98a09aed084224014 ./Sources/Sentry/SentryUIViewControllerSwizzling.m +3a082bf45b02126a86eedd700a50be0df4b07e4e0a3bcdba325b5aaad3e00646 ./Sources/Sentry/SentryUIViewControllerSwizzling.m e95e62ec7363984f20c78643bb7d992a41a740f97e1befb71525ac34caf88b37 ./Sources/Sentry/SentryNSDataSwizzling.m cc3849725bd1733515c71742872bed94ca47d2c115ef9d8c98383eae2e171925 ./Sources/Sentry/SentrySubClassFinder.m 59db11da66e6ac0058526be0be08b57cdccd3727033e85164a631b205e972134 ./Sources/Sentry/SentryCoreDataSwizzling.m From ed603afaa1eedf53381703de3a69e3cbf89769ee Mon Sep 17 00:00:00 2001 From: Dhiogo Brustolin Date: Fri, 24 Nov 2023 11:07:01 +0100 Subject: [PATCH 12/22] Apply suggestions from code review --- Sources/Sentry/SentryUIViewControllerSwizzling.m | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Sources/Sentry/SentryUIViewControllerSwizzling.m b/Sources/Sentry/SentryUIViewControllerSwizzling.m index 2e5970ceb75..e9fbcb8b5e1 100644 --- a/Sources/Sentry/SentryUIViewControllerSwizzling.m +++ b/Sources/Sentry/SentryUIViewControllerSwizzling.m @@ -79,8 +79,8 @@ - (void)start if (pathToImage != nil) { [self swizzleUIViewControllersOfImage:pathToImage]; } else { - SENTRY_LOG_DEBUG( - @"UIViewControllerSwizzling: Failed to find binary image for %@ module.", include); + SENTRY_LOG_WARN( + @"Failed to find the binary image for inAppInclude <@%> and, therefore can't instrument UIViewControllers in that binary", include); } } From 00668a185e7406d43acccbf61c710a630a9c1c0f Mon Sep 17 00:00:00 2001 From: Sentry Github Bot Date: Fri, 24 Nov 2023 10:08:09 +0000 Subject: [PATCH 13/22] Format code --- Sources/Sentry/SentryUIViewControllerSwizzling.m | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Sources/Sentry/SentryUIViewControllerSwizzling.m b/Sources/Sentry/SentryUIViewControllerSwizzling.m index e9fbcb8b5e1..52d98a94d8c 100644 --- a/Sources/Sentry/SentryUIViewControllerSwizzling.m +++ b/Sources/Sentry/SentryUIViewControllerSwizzling.m @@ -79,8 +79,9 @@ - (void)start if (pathToImage != nil) { [self swizzleUIViewControllersOfImage:pathToImage]; } else { - SENTRY_LOG_WARN( - @"Failed to find the binary image for inAppInclude <@%> and, therefore can't instrument UIViewControllers in that binary", include); + SENTRY_LOG_WARN(@"Failed to find the binary image for inAppInclude <@%> and, therefore " + @"can't instrument UIViewControllers in that binary", + include); } } From 49bfca6f64203942384b41039adb5b2ce93815a3 Mon Sep 17 00:00:00 2001 From: Dhiogo Brustolin Date: Fri, 24 Nov 2023 11:52:54 +0100 Subject: [PATCH 14/22] Update Sources/Sentry/SentryUIViewControllerSwizzling.m --- Sources/Sentry/SentryUIViewControllerSwizzling.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/Sentry/SentryUIViewControllerSwizzling.m b/Sources/Sentry/SentryUIViewControllerSwizzling.m index 52d98a94d8c..c87852ddfba 100644 --- a/Sources/Sentry/SentryUIViewControllerSwizzling.m +++ b/Sources/Sentry/SentryUIViewControllerSwizzling.m @@ -79,7 +79,7 @@ - (void)start if (pathToImage != nil) { [self swizzleUIViewControllersOfImage:pathToImage]; } else { - SENTRY_LOG_WARN(@"Failed to find the binary image for inAppInclude <@%> and, therefore " + SENTRY_LOG_WARN(@"Failed to find the binary image for inAppInclude <%@> and, therefore " @"can't instrument UIViewControllers in that binary", include); } From 129c342d3371818e6c37b6e70a5885358a653bc8 Mon Sep 17 00:00:00 2001 From: Dhiogo Brustolin Date: Mon, 27 Nov 2023 10:36:25 +0100 Subject: [PATCH 15/22] Update no-changes-in-high-risk-files.sh --- scripts/no-changes-in-high-risk-files.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/no-changes-in-high-risk-files.sh b/scripts/no-changes-in-high-risk-files.sh index c5d8b0dde85..563874eb9f6 100755 --- a/scripts/no-changes-in-high-risk-files.sh +++ b/scripts/no-changes-in-high-risk-files.sh @@ -6,7 +6,7 @@ set -euo pipefail ACTUAL=$(shasum -a 256 ./Sources/Sentry/SentryNSURLSessionTaskSearch.m ./Sources/Sentry/SentryNetworkTracker.m ./Sources/Sentry/SentryUIViewControllerSwizzling.m ./Sources/Sentry/SentryNSDataSwizzling.m ./Sources/Sentry/SentrySubClassFinder.m ./Sources/Sentry/SentryCoreDataSwizzling.m ./Sources/Sentry/SentrySwizzleWrapper.m ./Sources/Sentry/include/SentrySwizzle.h ./Sources/Sentry/SentrySwizzle.m) EXPECTED="819d5ca5e3db2ac23c859b14c149b7f0754d3ae88bea1dba92c18f49a81da0e1 ./Sources/Sentry/SentryNSURLSessionTaskSearch.m 2f9ea6984ff32b53fc03c386b648f4f1bdf8737ce69050d25ce6d1307f8d1672 ./Sources/Sentry/SentryNetworkTracker.m -3a082bf45b02126a86eedd700a50be0df4b07e4e0a3bcdba325b5aaad3e00646 ./Sources/Sentry/SentryUIViewControllerSwizzling.m +de3bcc594035e578c0012c0369759587f16106510390c99d2fc70b37637c2d00 ./Sources/Sentry/SentryUIViewControllerSwizzling.m e95e62ec7363984f20c78643bb7d992a41a740f97e1befb71525ac34caf88b37 ./Sources/Sentry/SentryNSDataSwizzling.m cc3849725bd1733515c71742872bed94ca47d2c115ef9d8c98383eae2e171925 ./Sources/Sentry/SentrySubClassFinder.m 59db11da66e6ac0058526be0be08b57cdccd3727033e85164a631b205e972134 ./Sources/Sentry/SentryCoreDataSwizzling.m From 0141922057a6717dd35575e32c69cd8153bd8012 Mon Sep 17 00:00:00 2001 From: Dhiogo Brustolin Date: Mon, 27 Nov 2023 16:22:15 +0100 Subject: [PATCH 16/22] search lib --- Sources/Sentry/SentryBinaryImageCache.m | 2 +- Tests/SentryTests/SentryBinaryImageCacheTests.swift | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/Sources/Sentry/SentryBinaryImageCache.m b/Sources/Sentry/SentryBinaryImageCache.m index 3bfd6be81b2..1d434192060 100644 --- a/Sources/Sentry/SentryBinaryImageCache.m +++ b/Sources/Sentry/SentryBinaryImageCache.m @@ -104,7 +104,7 @@ - (nullable NSString *)pathForImage:(NSString *)binaryName @synchronized(self) { for (SentryBinaryImageInfo *info in _cache) { if ([[info.name.lastPathComponent lowercaseString] - isEqualToString:binaryName.lowercaseString]) { + hasPrefix:binaryName.lowercaseString]) { return info.name; } } diff --git a/Tests/SentryTests/SentryBinaryImageCacheTests.swift b/Tests/SentryTests/SentryBinaryImageCacheTests.swift index 285b4f218cb..7c4f42da1a0 100644 --- a/Tests/SentryTests/SentryBinaryImageCacheTests.swift +++ b/Tests/SentryTests/SentryBinaryImageCacheTests.swift @@ -99,12 +99,20 @@ class SentryBinaryImageCacheTests: XCTestCase { func testImagePathByName() { var binaryImage = createCrashBinaryImage(0) + var binaryImage2 = createCrashBinaryImage(1) sut.binaryImageAdded(&binaryImage) + sut.binaryImageAdded(&binaryImage2) let path = sut.path(forImage: "Expected Name at 0") expect(path) == "Expected Name at 0" - let didNotFind = sut.path(forImage: "Another_Image") + let path2 = sut.path(forImage: "Expected Name at 1") + expect(path2) == "Expected Name at 1" + + let path3 = sut.path(forImage: "Expected") + expect(path3) == "Expected Name at 0" + + let didNotFind = sut.path(forImage: "Name at 0") expect(didNotFind) == nil } From 10fc1263c2ca6622fbcde77496e73bac9c850652 Mon Sep 17 00:00:00 2001 From: Philipp Hofmann Date: Wed, 29 Nov 2023 10:08:04 +0100 Subject: [PATCH 17/22] ref: Extract checking image name inApp (#3452) Add method isImageNameInApp to SentryInAppLogic, so both SentryInAppLogic and SentryBinaryImageCache use the same code. Co-authored-by: Andrew McKnight --- Sources/Sentry/SentryBinaryImageCache.m | 6 +++--- Sources/Sentry/SentryInAppLogic.m | 7 ++++++- Sources/Sentry/SentryUIViewControllerSwizzling.m | 6 +++--- .../Sentry/include/HybridPublic/SentryBinaryImageCache.h | 2 +- Sources/Sentry/include/SentryInAppLogic.h | 2 ++ Tests/SentryTests/SentryBinaryImageCacheTests.swift | 8 ++++---- scripts/no-changes-in-high-risk-files.sh | 2 +- 7 files changed, 20 insertions(+), 13 deletions(-) diff --git a/Sources/Sentry/SentryBinaryImageCache.m b/Sources/Sentry/SentryBinaryImageCache.m index 1d434192060..c9d05365187 100644 --- a/Sources/Sentry/SentryBinaryImageCache.m +++ b/Sources/Sentry/SentryBinaryImageCache.m @@ -1,6 +1,7 @@ #import "SentryBinaryImageCache.h" #import "SentryCrashBinaryImageCache.h" #import "SentryDependencyContainer.h" +#import "SentryInAppLogic.h" static void binaryImageWasAdded(const SentryCrashBinaryImage *image); @@ -99,12 +100,11 @@ - (NSInteger)indexOfImage:(uint64_t)address return -1; // Address not found } -- (nullable NSString *)pathForImage:(NSString *)binaryName +- (nullable NSString *)pathForInAppInclude:(NSString *)inAppInclude { @synchronized(self) { for (SentryBinaryImageInfo *info in _cache) { - if ([[info.name.lastPathComponent lowercaseString] - hasPrefix:binaryName.lowercaseString]) { + if ([SentryInAppLogic isImageNameInApp:info.name inAppInclude:inAppInclude]) { return info.name; } } diff --git a/Sources/Sentry/SentryInAppLogic.m b/Sources/Sentry/SentryInAppLogic.m index 251a6a121e9..1b5ac288b20 100644 --- a/Sources/Sentry/SentryInAppLogic.m +++ b/Sources/Sentry/SentryInAppLogic.m @@ -24,7 +24,7 @@ - (BOOL)isInApp:(nullable NSString *)imageName } for (NSString *inAppInclude in self.inAppIncludes) { - if ([imageName.lastPathComponent.lowercaseString hasPrefix:inAppInclude.lowercaseString]) + if ([SentryInAppLogic isImageNameInApp:imageName inAppInclude:inAppInclude]) return YES; } @@ -46,6 +46,11 @@ - (BOOL)isClassInApp:(Class)targetClass return [self isInApp:classImageName]; } ++ (BOOL)isImageNameInApp:(NSString *)imageName inAppInclude:(NSString *)inAppInclude +{ + return [imageName.lastPathComponent.lowercaseString hasPrefix:inAppInclude.lowercaseString]; +} + @end NS_ASSUME_NONNULL_END diff --git a/Sources/Sentry/SentryUIViewControllerSwizzling.m b/Sources/Sentry/SentryUIViewControllerSwizzling.m index c87852ddfba..e8a283d777a 100644 --- a/Sources/Sentry/SentryUIViewControllerSwizzling.m +++ b/Sources/Sentry/SentryUIViewControllerSwizzling.m @@ -74,14 +74,14 @@ - (instancetype)initWithOptions:(SentryOptions *)options - (void)start { - for (NSString *include in self.inAppLogic.inAppIncludes) { - NSString *pathToImage = [self.binaryImageCache pathForImage:include]; + for (NSString *inAppInclude in self.inAppLogic.inAppIncludes) { + NSString *pathToImage = [self.binaryImageCache pathForInAppInclude:inAppInclude]; if (pathToImage != nil) { [self swizzleUIViewControllersOfImage:pathToImage]; } else { SENTRY_LOG_WARN(@"Failed to find the binary image for inAppInclude <%@> and, therefore " @"can't instrument UIViewControllers in that binary", - include); + inAppInclude); } } diff --git a/Sources/Sentry/include/HybridPublic/SentryBinaryImageCache.h b/Sources/Sentry/include/HybridPublic/SentryBinaryImageCache.h index 49bb77c6f2b..46125e2185f 100644 --- a/Sources/Sentry/include/HybridPublic/SentryBinaryImageCache.h +++ b/Sources/Sentry/include/HybridPublic/SentryBinaryImageCache.h @@ -21,7 +21,7 @@ NS_ASSUME_NONNULL_BEGIN - (nullable SentryBinaryImageInfo *)imageByAddress:(const uint64_t)address; -- (nullable NSString *)pathForImage:(NSString *)binaryName; +- (nullable NSString *)pathForInAppInclude:(NSString *)inAppInclude; @end diff --git a/Sources/Sentry/include/SentryInAppLogic.h b/Sources/Sentry/include/SentryInAppLogic.h index 2ee51236dd5..b2031bb6df8 100644 --- a/Sources/Sentry/include/SentryInAppLogic.h +++ b/Sources/Sentry/include/SentryInAppLogic.h @@ -76,6 +76,8 @@ SENTRY_NO_INIT */ - (BOOL)isClassInApp:(Class)targetClass; ++ (BOOL)isImageNameInApp:(NSString *)imageName inAppInclude:(NSString *)inAppInclude; + @end NS_ASSUME_NONNULL_END diff --git a/Tests/SentryTests/SentryBinaryImageCacheTests.swift b/Tests/SentryTests/SentryBinaryImageCacheTests.swift index 7c4f42da1a0..86c800aa02e 100644 --- a/Tests/SentryTests/SentryBinaryImageCacheTests.swift +++ b/Tests/SentryTests/SentryBinaryImageCacheTests.swift @@ -103,16 +103,16 @@ class SentryBinaryImageCacheTests: XCTestCase { sut.binaryImageAdded(&binaryImage) sut.binaryImageAdded(&binaryImage2) - let path = sut.path(forImage: "Expected Name at 0") + let path = sut.pathFor(inAppInclude: "Expected Name at 0") expect(path) == "Expected Name at 0" - let path2 = sut.path(forImage: "Expected Name at 1") + let path2 = sut.pathFor(inAppInclude: "Expected Name at 1") expect(path2) == "Expected Name at 1" - let path3 = sut.path(forImage: "Expected") + let path3 = sut.pathFor(inAppInclude: "Expected") expect(path3) == "Expected Name at 0" - let didNotFind = sut.path(forImage: "Name at 0") + let didNotFind = sut.pathFor(inAppInclude: "Name at 0") expect(didNotFind) == nil } diff --git a/scripts/no-changes-in-high-risk-files.sh b/scripts/no-changes-in-high-risk-files.sh index 563874eb9f6..a110a7ce4eb 100755 --- a/scripts/no-changes-in-high-risk-files.sh +++ b/scripts/no-changes-in-high-risk-files.sh @@ -6,7 +6,7 @@ set -euo pipefail ACTUAL=$(shasum -a 256 ./Sources/Sentry/SentryNSURLSessionTaskSearch.m ./Sources/Sentry/SentryNetworkTracker.m ./Sources/Sentry/SentryUIViewControllerSwizzling.m ./Sources/Sentry/SentryNSDataSwizzling.m ./Sources/Sentry/SentrySubClassFinder.m ./Sources/Sentry/SentryCoreDataSwizzling.m ./Sources/Sentry/SentrySwizzleWrapper.m ./Sources/Sentry/include/SentrySwizzle.h ./Sources/Sentry/SentrySwizzle.m) EXPECTED="819d5ca5e3db2ac23c859b14c149b7f0754d3ae88bea1dba92c18f49a81da0e1 ./Sources/Sentry/SentryNSURLSessionTaskSearch.m 2f9ea6984ff32b53fc03c386b648f4f1bdf8737ce69050d25ce6d1307f8d1672 ./Sources/Sentry/SentryNetworkTracker.m -de3bcc594035e578c0012c0369759587f16106510390c99d2fc70b37637c2d00 ./Sources/Sentry/SentryUIViewControllerSwizzling.m +40f476800b32cf885dba9ac3de75d93b6f536e819fe8e51d071b4610c879b416 ./Sources/Sentry/SentryUIViewControllerSwizzling.m e95e62ec7363984f20c78643bb7d992a41a740f97e1befb71525ac34caf88b37 ./Sources/Sentry/SentryNSDataSwizzling.m cc3849725bd1733515c71742872bed94ca47d2c115ef9d8c98383eae2e171925 ./Sources/Sentry/SentrySubClassFinder.m 59db11da66e6ac0058526be0be08b57cdccd3727033e85164a631b205e972134 ./Sources/Sentry/SentryCoreDataSwizzling.m From 8e7f7a05d36427c942482be81708c2ec50e08658 Mon Sep 17 00:00:00 2001 From: Dhiogo Brustolin Date: Wed, 29 Nov 2023 11:01:30 +0100 Subject: [PATCH 18/22] Extra test framework --- Sentry.xcodeproj/project.pbxproj | 426 +++++++++++++++++- .../ExternalUIViewController.swift | 0 .../SentryTestUtilsDynamic.h | 11 + ...SentryUIViewControllerSwizzlingTests.swift | 1 + 4 files changed, 429 insertions(+), 9 deletions(-) rename {SentryTestUtils => SentryTestUtilsDynamic}/ExternalUIViewController.swift (100%) create mode 100644 SentryTestUtilsDynamic/SentryTestUtilsDynamic.h diff --git a/Sentry.xcodeproj/project.pbxproj b/Sentry.xcodeproj/project.pbxproj index 1c84c692de4..c844195c4fd 100644 --- a/Sentry.xcodeproj/project.pbxproj +++ b/Sentry.xcodeproj/project.pbxproj @@ -740,7 +740,6 @@ D808FB88281AB33C009A2A33 /* SentryUIEventTrackerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D808FB86281AB31D009A2A33 /* SentryUIEventTrackerTests.swift */; }; D808FB8B281BCE96009A2A33 /* TestSentrySwizzleWrapper.swift in Sources */ = {isa = PBXBuildFile; fileRef = D808FB89281BCE46009A2A33 /* TestSentrySwizzleWrapper.swift */; }; D808FB92281BF6EC009A2A33 /* SentryUIEventTrackingIntegrationTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D808FB90281BF6E9009A2A33 /* SentryUIEventTrackingIntegrationTests.swift */; }; - D80C990B2B0DFE410052F311 /* ExternalUIViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D80C990A2B0DFE410052F311 /* ExternalUIViewController.swift */; }; D8137D54272B53070082656C /* TestSentrySpan.m in Sources */ = {isa = PBXBuildFile; fileRef = D8137D53272B53070082656C /* TestSentrySpan.m */; }; D8199DBE29376EDE0074249E /* SentryInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = D8199DB829376ECC0074249E /* SentryInternal.h */; }; D8199DBF29376EE20074249E /* SentryInternal.m in Sources */ = {isa = PBXBuildFile; fileRef = D8199DB929376ECC0074249E /* SentryInternal.m */; }; @@ -758,6 +757,10 @@ D84541182A2DC2CD00E2B11C /* SentryBinaryImageCacheTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D84541172A2DC2CD00E2B11C /* SentryBinaryImageCacheTests.swift */; }; D84793262788737D00BE8E99 /* SentryByteCountFormatter.m in Sources */ = {isa = PBXBuildFile; fileRef = D84793242788737D00BE8E99 /* SentryByteCountFormatter.m */; }; D8479328278873A100BE8E99 /* SentryByteCountFormatter.h in Headers */ = {isa = PBXBuildFile; fileRef = D8479327278873A100BE8E99 /* SentryByteCountFormatter.h */; }; + D84DAD502B17428D003CF120 /* SentryTestUtilsDynamic.h in Headers */ = {isa = PBXBuildFile; fileRef = D84DAD4F2B17428D003CF120 /* SentryTestUtilsDynamic.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D84DAD582B1742A9003CF120 /* ExternalUIViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D80C990A2B0DFE410052F311 /* ExternalUIViewController.swift */; }; + D84DAD592B1742C1003CF120 /* SentryTestUtilsDynamic.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D84DAD4D2B17428D003CF120 /* SentryTestUtilsDynamic.framework */; }; + D84DAD5A2B1742C1003CF120 /* SentryTestUtilsDynamic.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = D84DAD4D2B17428D003CF120 /* SentryTestUtilsDynamic.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; D84F833D2A1CC401005828E0 /* SentrySwiftAsyncIntegration.h in Headers */ = {isa = PBXBuildFile; fileRef = D84F833B2A1CC401005828E0 /* SentrySwiftAsyncIntegration.h */; }; D84F833E2A1CC401005828E0 /* SentrySwiftAsyncIntegration.m in Sources */ = {isa = PBXBuildFile; fileRef = D84F833C2A1CC401005828E0 /* SentrySwiftAsyncIntegration.m */; }; D85596F3280580F10041FF8B /* SentryScreenshotIntegration.m in Sources */ = {isa = PBXBuildFile; fileRef = D85596F1280580F10041FF8B /* SentryScreenshotIntegration.m */; }; @@ -886,8 +889,29 @@ remoteGlobalIDString = D81A3487291D0AC0005A27A9; remoteInfo = SentryPrivate; }; + D84DAD5B2B1742C1003CF120 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 6327C5CA1EB8A783004E799B /* Project object */; + proxyType = 1; + remoteGlobalIDString = D84DAD4C2B17428D003CF120; + remoteInfo = SentryTestUtilsDynamic; + }; /* End PBXContainerItemProxy section */ +/* Begin PBXCopyFilesBuildPhase section */ + D84DAD5D2B1742C1003CF120 /* Embed Frameworks */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + D84DAD5A2B1742C1003CF120 /* SentryTestUtilsDynamic.framework in Embed Frameworks */, + ); + name = "Embed Frameworks"; + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXCopyFilesBuildPhase section */ + /* Begin PBXFileReference section */ 0354A22A2A134D9C003C3A04 /* SentryProfilerState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SentryProfilerState.h; path = Sources/Sentry/include/SentryProfilerState.h; sourceTree = SOURCE_ROOT; }; 0356A56E288B4612008BF593 /* SentryProfilesSampler.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SentryProfilesSampler.h; path = Sources/Sentry/include/SentryProfilesSampler.h; sourceTree = SOURCE_ROOT; }; @@ -1716,6 +1740,8 @@ D84541192A2DC55100E2B11C /* SentryBinaryImageCache+Private.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "SentryBinaryImageCache+Private.h"; sourceTree = ""; }; D84793242788737D00BE8E99 /* SentryByteCountFormatter.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SentryByteCountFormatter.m; sourceTree = ""; }; D8479327278873A100BE8E99 /* SentryByteCountFormatter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SentryByteCountFormatter.h; path = include/SentryByteCountFormatter.h; sourceTree = ""; }; + D84DAD4D2B17428D003CF120 /* SentryTestUtilsDynamic.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SentryTestUtilsDynamic.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + D84DAD4F2B17428D003CF120 /* SentryTestUtilsDynamic.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SentryTestUtilsDynamic.h; sourceTree = ""; }; D84F833B2A1CC401005828E0 /* SentrySwiftAsyncIntegration.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SentrySwiftAsyncIntegration.h; path = include/SentrySwiftAsyncIntegration.h; sourceTree = ""; }; D84F833C2A1CC401005828E0 /* SentrySwiftAsyncIntegration.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SentrySwiftAsyncIntegration.m; sourceTree = ""; }; D85596F1280580F10041FF8B /* SentryScreenshotIntegration.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SentryScreenshotIntegration.m; sourceTree = ""; }; @@ -1811,6 +1837,7 @@ files = ( 62986F032B03D250008E2D62 /* Nimble in Frameworks */, 8431F01C29B2854200D8DC56 /* libSentryTestUtils.a in Frameworks */, + D84DAD592B1742C1003CF120 /* SentryTestUtilsDynamic.framework in Frameworks */, 63AA766A1EB8CB2F00D153DE /* Sentry.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; @@ -1848,6 +1875,13 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + D84DAD4A2B17428D003CF120 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ @@ -2049,6 +2083,7 @@ 63AA756E1EB8AEDB00D153DE /* Sources */, 63AA75921EB8AEDB00D153DE /* Tests */, 8431F00B29B284F200D8DC56 /* SentryTestUtils */, + D84DAD4E2B17428D003CF120 /* SentryTestUtilsDynamic */, 7D826E3C2390840E00EED93D /* Utils */, D8105B37297A86B800299F03 /* Recovered References */, ); @@ -2065,6 +2100,7 @@ D8199DAA29376E9B0074249E /* SentrySwiftUI.framework */, 8431EFD929B27B1100D8DC56 /* SentryProfilerTests.xctest */, 8431F00A29B284F200D8DC56 /* libSentryTestUtils.a */, + D84DAD4D2B17428D003CF120 /* SentryTestUtilsDynamic.framework */, ); name = Products; sourceTree = ""; @@ -3222,7 +3258,6 @@ 844EDC7829415AB300C86F34 /* TestSentrySystemWrapper.swift */, 844EDCE72947DCD700C86F34 /* TestSentryNSTimerFactory.swift */, 84B7FA3B29B2866200AD93B1 /* SentryTestUtils-ObjC-BridgingHeader.h */, - D80C990A2B0DFE410052F311 /* ExternalUIViewController.swift */, 62C25C852B075F4900C68CBD /* TestOptions.swift */, ); path = SentryTestUtils; @@ -3355,6 +3390,15 @@ name = Tools; sourceTree = ""; }; + D84DAD4E2B17428D003CF120 /* SentryTestUtilsDynamic */ = { + isa = PBXGroup; + children = ( + D84DAD4F2B17428D003CF120 /* SentryTestUtilsDynamic.h */, + D80C990A2B0DFE410052F311 /* ExternalUIViewController.swift */, + ); + path = SentryTestUtilsDynamic; + sourceTree = ""; + }; D85596EF280580BE0041FF8B /* Screenshot */ = { isa = PBXGroup; children = ( @@ -3773,6 +3817,14 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + D84DAD482B17428D003CF120 /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + D84DAD502B17428D003CF120 /* SentryTestUtilsDynamic.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; /* End PBXHeadersBuildPhase section */ /* Begin PBXNativeTarget section */ @@ -3802,12 +3854,14 @@ 63AA76611EB8CB2F00D153DE /* Sources */, 63AA76621EB8CB2F00D153DE /* Frameworks */, 63AA76631EB8CB2F00D153DE /* Resources */, + D84DAD5D2B1742C1003CF120 /* Embed Frameworks */, ); buildRules = ( ); dependencies = ( D80C4A4F291E5068000A472C /* PBXTargetDependency */, 63AA766C1EB8CB2F00D153DE /* PBXTargetDependency */, + D84DAD5C2B1742C1003CF120 /* PBXTargetDependency */, ); name = SentryTests; packageProductDependencies = ( @@ -3892,6 +3946,24 @@ productReference = D81A3488291D0AC0005A27A9 /* SentryPrivate.framework */; productType = "com.apple.product-type.framework"; }; + D84DAD4C2B17428D003CF120 /* SentryTestUtilsDynamic */ = { + isa = PBXNativeTarget; + buildConfigurationList = D84DAD512B17428D003CF120 /* Build configuration list for PBXNativeTarget "SentryTestUtilsDynamic" */; + buildPhases = ( + D84DAD482B17428D003CF120 /* Headers */, + D84DAD492B17428D003CF120 /* Sources */, + D84DAD4A2B17428D003CF120 /* Frameworks */, + D84DAD4B2B17428D003CF120 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = SentryTestUtilsDynamic; + productName = SentryTestUtilsDynamic; + productReference = D84DAD4D2B17428D003CF120 /* SentryTestUtilsDynamic.framework */; + productType = "com.apple.product-type.framework"; + }; /* End PBXNativeTarget section */ /* Begin PBXProject section */ @@ -3929,6 +4001,9 @@ CreatedOnToolsVersion = 14.1; ProvisioningStyle = Manual; }; + D84DAD4C2B17428D003CF120 = { + CreatedOnToolsVersion = 15.0.1; + }; }; }; buildConfigurationList = 6327C5CD1EB8A783004E799B /* Build configuration list for PBXProject "Sentry" */; @@ -3953,6 +4028,7 @@ D8199DA929376E9B0074249E /* SentrySwiftUI */, 8431EECF29B27B1100D8DC56 /* SentryProfilerTests */, 8431F00929B284F200D8DC56 /* SentryTestUtils */, + D84DAD4C2B17428D003CF120 /* SentryTestUtilsDynamic */, ); }; /* End PBXProject section */ @@ -3996,6 +4072,13 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + D84DAD4B2B17428D003CF120 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; /* End PBXResourcesBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ @@ -4526,7 +4609,6 @@ 84AC61DB29F7654A009EEF61 /* TestDispatchSourceWrapper.swift in Sources */, 8431F01729B2851500D8DC56 /* TestSentrySystemWrapper.swift in Sources */, 84281C632A579D0700EE88F2 /* SentryProfilerMocks.mm in Sources */, - D80C990B2B0DFE410052F311 /* ExternalUIViewController.swift in Sources */, 84B7FA4129B28CD200AD93B1 /* TestSentryDispatchQueueWrapper.swift in Sources */, 84B7FA3E29B28ADD00AD93B1 /* TestClient.swift in Sources */, ); @@ -4553,6 +4635,14 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + D84DAD492B17428D003CF120 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + D84DAD582B1742A9003CF120 /* ExternalUIViewController.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; /* End PBXSourcesBuildPhase section */ /* Begin PBXTargetDependency section */ @@ -4596,6 +4686,11 @@ target = D81A3487291D0AC0005A27A9 /* SentryPrivate */; targetProxy = D81A3494291D0AD5005A27A9 /* PBXContainerItemProxy */; }; + D84DAD5C2B1742C1003CF120 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = D84DAD4C2B17428D003CF120 /* SentryTestUtilsDynamic */; + targetProxy = D84DAD5B2B1742C1003CF120 /* PBXContainerItemProxy */; + }; /* End PBXTargetDependency section */ /* Begin XCBuildConfiguration section */ @@ -5265,7 +5360,7 @@ DEVELOPMENT_TEAM = ""; EXECUTABLE_PREFIX = lib; GCC_C_LANGUAGE_STANDARD = gnu99; - MACH_O_TYPE = mh_dylib; + MACH_O_TYPE = staticlib; MTL_ENABLE_DEBUG_INFO = YES; MTL_FAST_MATH = YES; PRODUCT_BUNDLE_IDENTIFIER = io.sentry.SentryTestUtils; @@ -5419,7 +5514,7 @@ DEVELOPMENT_TEAM = ""; EXECUTABLE_PREFIX = lib; GCC_C_LANGUAGE_STANDARD = gnu99; - MACH_O_TYPE = mh_dylib; + MACH_O_TYPE = staticlib; MTL_ENABLE_DEBUG_INFO = YES; MTL_FAST_MATH = YES; PRODUCT_BUNDLE_IDENTIFIER = io.sentry.SentryTestUtils; @@ -5450,7 +5545,7 @@ DEVELOPMENT_TEAM = ""; EXECUTABLE_PREFIX = lib; GCC_C_LANGUAGE_STANDARD = gnu99; - MACH_O_TYPE = mh_dylib; + MACH_O_TYPE = staticlib; MTL_FAST_MATH = YES; PRODUCT_BUNDLE_IDENTIFIER = io.sentry.SentryTestUtils; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -5480,7 +5575,7 @@ DEVELOPMENT_TEAM = ""; EXECUTABLE_PREFIX = lib; GCC_C_LANGUAGE_STANDARD = gnu99; - MACH_O_TYPE = mh_dylib; + MACH_O_TYPE = staticlib; MTL_FAST_MATH = YES; PRODUCT_BUNDLE_IDENTIFIER = io.sentry.SentryTestUtils; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -5510,7 +5605,7 @@ DEVELOPMENT_TEAM = ""; EXECUTABLE_PREFIX = lib; GCC_C_LANGUAGE_STANDARD = gnu99; - MACH_O_TYPE = mh_dylib; + MACH_O_TYPE = staticlib; MTL_FAST_MATH = YES; PRODUCT_BUNDLE_IDENTIFIER = io.sentry.SentryTestUtils; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -5772,7 +5867,7 @@ DEVELOPMENT_TEAM = ""; EXECUTABLE_PREFIX = lib; GCC_C_LANGUAGE_STANDARD = gnu99; - MACH_O_TYPE = mh_dylib; + MACH_O_TYPE = staticlib; MTL_FAST_MATH = YES; PRODUCT_BUNDLE_IDENTIFIER = io.sentry.SentryTestUtils; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -6222,6 +6317,306 @@ }; name = Release; }; + D84DAD522B17428D003CF120 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + DEFINES_MODULE = YES; + DEVELOPMENT_TEAM = 97JCY7859U; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + ENABLE_MODULE_VERIFIER = YES; + ENABLE_USER_SCRIPT_SANDBOXING = YES; + GCC_C_LANGUAGE_STANDARD = gnu17; + GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_KEY_NSHumanReadableCopyright = "Copyright © 2023 Sentry. All rights reserved."; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 17.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + LOCALIZATION_PREFERS_STRING_CATALOGS = YES; + MARKETING_VERSION = 1.0; + MODULE_VERIFIER_SUPPORTED_LANGUAGES = "objective-c objective-c++"; + MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu17 gnu++20"; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + PRODUCT_BUNDLE_IDENTIFIER = io.sentry.SentryTestUtilsDynamic; + PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = "DEBUG $(inherited)"; + SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + VERSIONING_SYSTEM = "apple-generic"; + }; + name = Debug; + }; + D84DAD532B17428D003CF120 /* Debug_without_UIKit */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + DEFINES_MODULE = YES; + DEVELOPMENT_TEAM = 97JCY7859U; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + ENABLE_MODULE_VERIFIER = YES; + ENABLE_USER_SCRIPT_SANDBOXING = YES; + GCC_C_LANGUAGE_STANDARD = gnu17; + GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_KEY_NSHumanReadableCopyright = "Copyright © 2023 Sentry. All rights reserved."; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 17.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + LOCALIZATION_PREFERS_STRING_CATALOGS = YES; + MARKETING_VERSION = 1.0; + MODULE_VERIFIER_SUPPORTED_LANGUAGES = "objective-c objective-c++"; + MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu17 gnu++20"; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + PRODUCT_BUNDLE_IDENTIFIER = io.sentry.SentryTestUtilsDynamic; + PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = "DEBUG $(inherited)"; + SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + VERSIONING_SYSTEM = "apple-generic"; + }; + name = Debug_without_UIKit; + }; + D84DAD542B17428D003CF120 /* Test */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + DEFINES_MODULE = YES; + DEVELOPMENT_TEAM = 97JCY7859U; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + ENABLE_MODULE_VERIFIER = YES; + ENABLE_USER_SCRIPT_SANDBOXING = YES; + GCC_C_LANGUAGE_STANDARD = gnu17; + GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_KEY_NSHumanReadableCopyright = "Copyright © 2023 Sentry. All rights reserved."; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 17.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + LOCALIZATION_PREFERS_STRING_CATALOGS = YES; + MARKETING_VERSION = 1.0; + MODULE_VERIFIER_SUPPORTED_LANGUAGES = "objective-c objective-c++"; + MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu17 gnu++20"; + MTL_FAST_MATH = YES; + PRODUCT_BUNDLE_IDENTIFIER = io.sentry.SentryTestUtilsDynamic; + PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + VERSIONING_SYSTEM = "apple-generic"; + }; + name = Test; + }; + D84DAD552B17428D003CF120 /* TestCI */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + DEFINES_MODULE = YES; + DEVELOPMENT_TEAM = 97JCY7859U; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + ENABLE_MODULE_VERIFIER = YES; + ENABLE_USER_SCRIPT_SANDBOXING = YES; + GCC_C_LANGUAGE_STANDARD = gnu17; + GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_KEY_NSHumanReadableCopyright = "Copyright © 2023 Sentry. All rights reserved."; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 17.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + LOCALIZATION_PREFERS_STRING_CATALOGS = YES; + MARKETING_VERSION = 1.0; + MODULE_VERIFIER_SUPPORTED_LANGUAGES = "objective-c objective-c++"; + MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu17 gnu++20"; + MTL_FAST_MATH = YES; + PRODUCT_BUNDLE_IDENTIFIER = io.sentry.SentryTestUtilsDynamic; + PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + VERSIONING_SYSTEM = "apple-generic"; + }; + name = TestCI; + }; + D84DAD562B17428D003CF120 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + DEFINES_MODULE = YES; + DEVELOPMENT_TEAM = 97JCY7859U; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + ENABLE_MODULE_VERIFIER = YES; + ENABLE_USER_SCRIPT_SANDBOXING = YES; + GCC_C_LANGUAGE_STANDARD = gnu17; + GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_KEY_NSHumanReadableCopyright = "Copyright © 2023 Sentry. All rights reserved."; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 17.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + LOCALIZATION_PREFERS_STRING_CATALOGS = YES; + MARKETING_VERSION = 1.0; + MODULE_VERIFIER_SUPPORTED_LANGUAGES = "objective-c objective-c++"; + MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu17 gnu++20"; + MTL_FAST_MATH = YES; + PRODUCT_BUNDLE_IDENTIFIER = io.sentry.SentryTestUtilsDynamic; + PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + VERSIONING_SYSTEM = "apple-generic"; + }; + name = Release; + }; + D84DAD572B17428D003CF120 /* Release_without_UIKit */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + DEFINES_MODULE = YES; + DEVELOPMENT_TEAM = 97JCY7859U; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + ENABLE_MODULE_VERIFIER = YES; + ENABLE_USER_SCRIPT_SANDBOXING = YES; + GCC_C_LANGUAGE_STANDARD = gnu17; + GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_KEY_NSHumanReadableCopyright = "Copyright © 2023 Sentry. All rights reserved."; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 17.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + LOCALIZATION_PREFERS_STRING_CATALOGS = YES; + MARKETING_VERSION = 1.0; + MODULE_VERIFIER_SUPPORTED_LANGUAGES = "objective-c objective-c++"; + MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu17 gnu++20"; + MTL_FAST_MATH = YES; + PRODUCT_BUNDLE_IDENTIFIER = io.sentry.SentryTestUtilsDynamic; + PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + VERSIONING_SYSTEM = "apple-generic"; + }; + name = Release_without_UIKit; + }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ @@ -6316,6 +6711,19 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; + D84DAD512B17428D003CF120 /* Build configuration list for PBXNativeTarget "SentryTestUtilsDynamic" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + D84DAD522B17428D003CF120 /* Debug */, + D84DAD532B17428D003CF120 /* Debug_without_UIKit */, + D84DAD542B17428D003CF120 /* Test */, + D84DAD552B17428D003CF120 /* TestCI */, + D84DAD562B17428D003CF120 /* Release */, + D84DAD572B17428D003CF120 /* Release_without_UIKit */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; /* End XCConfigurationList section */ /* Begin XCRemoteSwiftPackageReference section */ diff --git a/SentryTestUtils/ExternalUIViewController.swift b/SentryTestUtilsDynamic/ExternalUIViewController.swift similarity index 100% rename from SentryTestUtils/ExternalUIViewController.swift rename to SentryTestUtilsDynamic/ExternalUIViewController.swift diff --git a/SentryTestUtilsDynamic/SentryTestUtilsDynamic.h b/SentryTestUtilsDynamic/SentryTestUtilsDynamic.h new file mode 100644 index 00000000000..00266506596 --- /dev/null +++ b/SentryTestUtilsDynamic/SentryTestUtilsDynamic.h @@ -0,0 +1,11 @@ +#import + +//! Project version number for SentryTestUtilsDynamic. +FOUNDATION_EXPORT double SentryTestUtilsDynamicVersionNumber; + +//! Project version string for SentryTestUtilsDynamic. +FOUNDATION_EXPORT const unsigned char SentryTestUtilsDynamicVersionString[]; + +// In this header, you should import all the public headers of your framework using statements like #import + + diff --git a/Tests/SentryTests/Integrations/Performance/UIViewController/SentryUIViewControllerSwizzlingTests.swift b/Tests/SentryTests/Integrations/Performance/UIViewController/SentryUIViewControllerSwizzlingTests.swift index 35acba06412..20963cebb58 100644 --- a/Tests/SentryTests/Integrations/Performance/UIViewController/SentryUIViewControllerSwizzlingTests.swift +++ b/Tests/SentryTests/Integrations/Performance/UIViewController/SentryUIViewControllerSwizzlingTests.swift @@ -2,6 +2,7 @@ import Sentry import SentryTestUtils +import SentryTestUtilsDynamic import XCTest class SentryUIViewControllerSwizzlingTests: XCTestCase { From ea2c5ea84b8267b978b86225c3a99155d29672a9 Mon Sep 17 00:00:00 2001 From: Sentry Github Bot Date: Wed, 29 Nov 2023 10:33:12 +0000 Subject: [PATCH 19/22] Format code --- SentryTestUtilsDynamic/SentryTestUtilsDynamic.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/SentryTestUtilsDynamic/SentryTestUtilsDynamic.h b/SentryTestUtilsDynamic/SentryTestUtilsDynamic.h index 00266506596..fec3046ee6f 100644 --- a/SentryTestUtilsDynamic/SentryTestUtilsDynamic.h +++ b/SentryTestUtilsDynamic/SentryTestUtilsDynamic.h @@ -6,6 +6,5 @@ FOUNDATION_EXPORT double SentryTestUtilsDynamicVersionNumber; //! Project version string for SentryTestUtilsDynamic. FOUNDATION_EXPORT const unsigned char SentryTestUtilsDynamicVersionString[]; -// In this header, you should import all the public headers of your framework using statements like #import - - +// In this header, you should import all the public headers of your framework using statements like +// #import From b17cbd744cc4cad41962c046c826cf705bc7de73 Mon Sep 17 00:00:00 2001 From: Dhiogo Brustolin Date: Wed, 29 Nov 2023 12:07:57 +0100 Subject: [PATCH 20/22] Update project.pbxproj --- Sentry.xcodeproj/project.pbxproj | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Sentry.xcodeproj/project.pbxproj b/Sentry.xcodeproj/project.pbxproj index c844195c4fd..63a21ca956d 100644 --- a/Sentry.xcodeproj/project.pbxproj +++ b/Sentry.xcodeproj/project.pbxproj @@ -6344,7 +6344,7 @@ GENERATE_INFOPLIST_FILE = YES; INFOPLIST_KEY_NSHumanReadableCopyright = "Copyright © 2023 Sentry. All rights reserved."; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 17.0; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -6396,7 +6396,7 @@ GENERATE_INFOPLIST_FILE = YES; INFOPLIST_KEY_NSHumanReadableCopyright = "Copyright © 2023 Sentry. All rights reserved."; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 17.0; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -6448,7 +6448,7 @@ GENERATE_INFOPLIST_FILE = YES; INFOPLIST_KEY_NSHumanReadableCopyright = "Copyright © 2023 Sentry. All rights reserved."; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 17.0; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -6497,7 +6497,7 @@ GENERATE_INFOPLIST_FILE = YES; INFOPLIST_KEY_NSHumanReadableCopyright = "Copyright © 2023 Sentry. All rights reserved."; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 17.0; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -6546,7 +6546,7 @@ GENERATE_INFOPLIST_FILE = YES; INFOPLIST_KEY_NSHumanReadableCopyright = "Copyright © 2023 Sentry. All rights reserved."; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 17.0; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -6595,7 +6595,7 @@ GENERATE_INFOPLIST_FILE = YES; INFOPLIST_KEY_NSHumanReadableCopyright = "Copyright © 2023 Sentry. All rights reserved."; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 17.0; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", From ecb03724a5405319f7d8d1c148a77424e2c6294f Mon Sep 17 00:00:00 2001 From: Dhiogo Brustolin Date: Wed, 29 Nov 2023 13:17:05 +0100 Subject: [PATCH 21/22] Update project.pbxproj --- Sentry.xcodeproj/project.pbxproj | 54 +++++++++++++++++++++++++------- 1 file changed, 42 insertions(+), 12 deletions(-) diff --git a/Sentry.xcodeproj/project.pbxproj b/Sentry.xcodeproj/project.pbxproj index 63a21ca956d..66d56df9c5d 100644 --- a/Sentry.xcodeproj/project.pbxproj +++ b/Sentry.xcodeproj/project.pbxproj @@ -6331,10 +6331,14 @@ CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; - CODE_SIGN_STYLE = Automatic; + CODE_SIGN_IDENTITY = "Apple Development"; + "CODE_SIGN_IDENTITY[sdk=macosx*]" = "Mac Developer"; + CODE_SIGN_STYLE = Manual; CURRENT_PROJECT_VERSION = 1; DEFINES_MODULE = YES; - DEVELOPMENT_TEAM = 97JCY7859U; + DEVELOPMENT_TEAM = ""; + "DEVELOPMENT_TEAM[sdk=macosx*]" = ""; + "DEVELOPMENT_TEAM[sdk=watchos*]" = ""; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; @@ -6358,6 +6362,7 @@ MTL_FAST_MATH = YES; PRODUCT_BUNDLE_IDENTIFIER = io.sentry.SentryTestUtilsDynamic; PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; + PROVISIONING_PROFILE_SPECIFIER = ""; SDKROOT = iphoneos; SKIP_INSTALL = YES; SWIFT_ACTIVE_COMPILATION_CONDITIONS = "DEBUG $(inherited)"; @@ -6383,10 +6388,14 @@ CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; - CODE_SIGN_STYLE = Automatic; + CODE_SIGN_IDENTITY = "Apple Development"; + "CODE_SIGN_IDENTITY[sdk=macosx*]" = "Mac Developer"; + CODE_SIGN_STYLE = Manual; CURRENT_PROJECT_VERSION = 1; DEFINES_MODULE = YES; - DEVELOPMENT_TEAM = 97JCY7859U; + DEVELOPMENT_TEAM = ""; + "DEVELOPMENT_TEAM[sdk=macosx*]" = ""; + "DEVELOPMENT_TEAM[sdk=watchos*]" = ""; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; @@ -6410,6 +6419,7 @@ MTL_FAST_MATH = YES; PRODUCT_BUNDLE_IDENTIFIER = io.sentry.SentryTestUtilsDynamic; PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; + PROVISIONING_PROFILE_SPECIFIER = ""; SDKROOT = iphoneos; SKIP_INSTALL = YES; SWIFT_ACTIVE_COMPILATION_CONDITIONS = "DEBUG $(inherited)"; @@ -6435,10 +6445,14 @@ CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; - CODE_SIGN_STYLE = Automatic; + CODE_SIGN_IDENTITY = "Apple Development"; + "CODE_SIGN_IDENTITY[sdk=macosx*]" = "Mac Developer"; + CODE_SIGN_STYLE = Manual; CURRENT_PROJECT_VERSION = 1; DEFINES_MODULE = YES; - DEVELOPMENT_TEAM = 97JCY7859U; + DEVELOPMENT_TEAM = ""; + "DEVELOPMENT_TEAM[sdk=macosx*]" = ""; + "DEVELOPMENT_TEAM[sdk=watchos*]" = ""; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; @@ -6461,6 +6475,7 @@ MTL_FAST_MATH = YES; PRODUCT_BUNDLE_IDENTIFIER = io.sentry.SentryTestUtilsDynamic; PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; + PROVISIONING_PROFILE_SPECIFIER = ""; SDKROOT = iphoneos; SKIP_INSTALL = YES; SWIFT_EMIT_LOC_STRINGS = YES; @@ -6484,10 +6499,14 @@ CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; - CODE_SIGN_STYLE = Automatic; + CODE_SIGN_IDENTITY = "Apple Development"; + "CODE_SIGN_IDENTITY[sdk=macosx*]" = "Mac Developer"; + CODE_SIGN_STYLE = Manual; CURRENT_PROJECT_VERSION = 1; DEFINES_MODULE = YES; - DEVELOPMENT_TEAM = 97JCY7859U; + DEVELOPMENT_TEAM = ""; + "DEVELOPMENT_TEAM[sdk=macosx*]" = ""; + "DEVELOPMENT_TEAM[sdk=watchos*]" = ""; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; @@ -6510,6 +6529,7 @@ MTL_FAST_MATH = YES; PRODUCT_BUNDLE_IDENTIFIER = io.sentry.SentryTestUtilsDynamic; PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; + PROVISIONING_PROFILE_SPECIFIER = ""; SDKROOT = iphoneos; SKIP_INSTALL = YES; SWIFT_EMIT_LOC_STRINGS = YES; @@ -6533,10 +6553,14 @@ CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; - CODE_SIGN_STYLE = Automatic; + CODE_SIGN_IDENTITY = "Apple Development"; + "CODE_SIGN_IDENTITY[sdk=macosx*]" = "Mac Developer"; + CODE_SIGN_STYLE = Manual; CURRENT_PROJECT_VERSION = 1; DEFINES_MODULE = YES; - DEVELOPMENT_TEAM = 97JCY7859U; + DEVELOPMENT_TEAM = ""; + "DEVELOPMENT_TEAM[sdk=macosx*]" = ""; + "DEVELOPMENT_TEAM[sdk=watchos*]" = ""; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; @@ -6559,6 +6583,7 @@ MTL_FAST_MATH = YES; PRODUCT_BUNDLE_IDENTIFIER = io.sentry.SentryTestUtilsDynamic; PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; + PROVISIONING_PROFILE_SPECIFIER = ""; SDKROOT = iphoneos; SKIP_INSTALL = YES; SWIFT_EMIT_LOC_STRINGS = YES; @@ -6582,10 +6607,14 @@ CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; - CODE_SIGN_STYLE = Automatic; + CODE_SIGN_IDENTITY = "Apple Development"; + "CODE_SIGN_IDENTITY[sdk=macosx*]" = "Mac Developer"; + CODE_SIGN_STYLE = Manual; CURRENT_PROJECT_VERSION = 1; DEFINES_MODULE = YES; - DEVELOPMENT_TEAM = 97JCY7859U; + DEVELOPMENT_TEAM = ""; + "DEVELOPMENT_TEAM[sdk=macosx*]" = ""; + "DEVELOPMENT_TEAM[sdk=watchos*]" = ""; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; @@ -6608,6 +6637,7 @@ MTL_FAST_MATH = YES; PRODUCT_BUNDLE_IDENTIFIER = io.sentry.SentryTestUtilsDynamic; PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; + PROVISIONING_PROFILE_SPECIFIER = ""; SDKROOT = iphoneos; SKIP_INSTALL = YES; SWIFT_EMIT_LOC_STRINGS = YES; From 527e6fc4715b811818c5e0ff05b5f95be9f9f2fe Mon Sep 17 00:00:00 2001 From: Dhiogo Brustolin Date: Wed, 29 Nov 2023 13:59:55 +0100 Subject: [PATCH 22/22] Update Tests/SentryTests/Integrations/Performance/UIViewController/SentryUIViewControllerSwizzlingTests.swift --- .../UIViewController/SentryUIViewControllerSwizzlingTests.swift | 1 + 1 file changed, 1 insertion(+) diff --git a/Tests/SentryTests/Integrations/Performance/UIViewController/SentryUIViewControllerSwizzlingTests.swift b/Tests/SentryTests/Integrations/Performance/UIViewController/SentryUIViewControllerSwizzlingTests.swift index 20963cebb58..4c86d0119bf 100644 --- a/Tests/SentryTests/Integrations/Performance/UIViewController/SentryUIViewControllerSwizzlingTests.swift +++ b/Tests/SentryTests/Integrations/Performance/UIViewController/SentryUIViewControllerSwizzlingTests.swift @@ -114,6 +114,7 @@ class SentryUIViewControllerSwizzlingTests: XCTestCase { //To finish the transaction we need to finish `initialDisplay` span //by calling `viewWillAppear` and reporting a new frame controller.viewWillAppear(false) + //This will call SentryTimeToDisplayTracker.framesTrackerHasNewFrame and finish the span its managing. Dynamic(SentryDependencyContainer.sharedInstance().framesTracker).reportNewFrame() XCTAssertNotNil(SentrySDK.span)