@@ -128,20 +128,12 @@ - (void)scanForUnregisteredSubclasses:(BOOL)shouldSubscribe {
128
128
queue: nil
129
129
usingBlock: ^(NSNotification *note) {
130
130
@strongify (self);
131
- [self _registerSubclassesInBundle : note.object];
131
+ [self _registerSubclassesInLoadedBundle : note.object];
132
132
}];
133
133
}
134
134
NSArray *bundles = [[NSBundle allFrameworks ] arrayByAddingObjectsFromArray: [NSBundle allBundles ]];
135
135
for (NSBundle *bundle in bundles) {
136
- // Skip bundles that aren't loaded yet.
137
- if (!bundle.loaded || !bundle.executablePath ) {
138
- continue ;
139
- }
140
- // Filter out any system bundles
141
- if ([bundle.bundlePath hasPrefix: @" /System/" ] || [bundle.bundlePath hasPrefix: @" /Library/" ]) {
142
- continue ;
143
- }
144
- [self _registerSubclassesInBundle: bundle];
136
+ [self _registerSubclassesInLoadedBundle: bundle];
145
137
}
146
138
}
147
139
@@ -338,6 +330,18 @@ - (void)_rawRegisterSubclass:(Class)kls {
338
330
_registeredSubclasses[[kls parseClassName ]] = subclassInfo;
339
331
}
340
332
333
+ - (void )_registerSubclassesInLoadedBundle : (NSBundle *)bundle {
334
+ // Skip bundles that aren't loaded yet.
335
+ if (!bundle.loaded || !bundle.executablePath ) {
336
+ return ;
337
+ }
338
+ // Filter out any system bundles
339
+ if ([bundle.bundlePath hasPrefix: @" /System/" ] || [bundle.bundlePath hasPrefix: @" /Library/" ] || [bundle.bundlePath rangeOfString: @" iPhoneSimulator.sdk" ].location != NSNotFound ) {
340
+ return ;
341
+ }
342
+ [self _registerSubclassesInBundle: bundle];
343
+ }
344
+
341
345
- (void )_registerSubclassesInBundle : (NSBundle *)bundle {
342
346
PFConsistencyAssert (bundle.loaded , @" Cannot register subclasses in a bundle that hasn't been loaded!" );
343
347
0 commit comments