@@ -64,19 +64,33 @@ + (NSBundle *)getViewResourceBundle {
64
64
bundledResource = @" InAppMessagingDisplayResources" ;
65
65
#endif // SWIFT_PACKAGE
66
66
67
+ NSMutableArray *bundles = [NSMutableArray array ];
68
+
69
+ // Resources may be in main bundle when statically linked.
70
+ NSBundle *mainBundle = [NSBundle mainBundle ];
71
+ if (mainBundle) {
72
+ [bundles addObject: mainBundle];
73
+ }
74
+ // Resources may be in the bundle associated with this class when
75
+ // dynamically linked.
76
+ NSBundle *bundleForClass = [NSBundle bundleForClass: myClass];
77
+ if (bundleForClass) {
78
+ [bundles addObject: bundleForClass];
79
+ }
80
+ // When embedding static frameworks from the zip distribution, the Xcode
81
+ // will copy the resources into the framework's directory.
82
+ NSBundle *frameworkBundle = [NSBundle
83
+ bundleWithURL:
84
+ [NSBundle .mainBundle.bundleURL
85
+ URLByAppendingPathComponent: @" Frameworks/FirebaseInAppMessaging.framework" ]];
86
+ if (frameworkBundle) {
87
+ [bundles addObject: frameworkBundle];
88
+ }
89
+
67
90
NSBundle *containingBundle;
68
91
NSURL *bundleURL;
69
92
// The containing bundle is different whether FIAM is statically or dynamically linked.
70
- for (containingBundle in @[
71
- // Statically linked.
72
- [NSBundle mainBundle ],
73
- // Dynamically linked.
74
- [NSBundle bundleForClass: myClass],
75
- // Embedded static framework (zip distribution).
76
- [NSBundle bundleWithURL: [NSBundle .mainBundle.bundleURL
77
- URLByAppendingPathComponent:
78
- @" Frameworks/FirebaseInAppMessaging.framework" ]]
79
- ]) {
93
+ for (containingBundle in bundles) {
80
94
bundleURL = [containingBundle URLForResource: bundledResource withExtension: @" bundle" ];
81
95
if (bundleURL != nil ) break ;
82
96
}
0 commit comments