@@ -447,7 +447,21 @@ - (void)indexContentWithTitle:(NSString *)title
447447}
448448
449449
450- - (void )indexContentWithUrl : (NSString *)url spotlightIdentifier : (NSString *)spotlightIdentifier canonicalId : (NSString *)canonicalId title : (NSString *)title description : (NSString *)description type : (NSString *)type thumbnailUrl : (NSURL *)thumbnailUrl thumbnailData : (NSData *)thumbnailData publiclyIndexable : (BOOL )publiclyIndexable userInfo : (NSDictionary *)userInfo keywords : (NSSet *)keywords expirationDate : (NSDate *)expirationDate callback : (callbackWithUrl)callback spotlightCallback : (callbackWithUrlAndSpotlightIdentifier)spotlightCallback {
450+ - (void )indexContentWithUrl : (NSString *)url
451+ spotlightIdentifier : (NSString *)spotlightIdentifier
452+ canonicalId : (NSString *)canonicalId
453+ title : (NSString *)title
454+ description : (NSString *)description
455+ type : (NSString *)type
456+ thumbnailUrl : (NSURL *)thumbnailUrl
457+ thumbnailData : (NSData *)thumbnailData
458+ publiclyIndexable : (BOOL )publiclyIndexable
459+ userInfo : (NSDictionary *)userInfo
460+ keywords : (NSSet *)keywords
461+ expirationDate : (NSDate *)expirationDate
462+ callback : (callbackWithUrl)callback
463+ spotlightCallback : (callbackWithUrlAndSpotlightIdentifier)spotlightCallback {
464+
451465#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 90000
452466
453467 id CSSearchableItemAttributeSetClass = NSClassFromString (@" CSSearchableItemAttributeSet" );
@@ -463,12 +477,15 @@ - (void)indexContentWithUrl:(NSString *)url spotlightIdentifier:(NSString *)spot
463477 ((void (*)(id , SEL , NSURL *))[attributes methodForSelector: setThumbnailURLSelector])(attributes, setThumbnailURLSelector, thumbnailUrl);
464478 SEL setThumbnailDataSelector = NSSelectorFromString (@" setThumbnailData:" );
465479 ((void (*)(id , SEL , NSData *))[attributes methodForSelector: setThumbnailDataSelector])(attributes, setThumbnailDataSelector, thumbnailData);
466-
467- if (canonicalId) {
468- SEL setWeakRelatedUniqueIdentifierSelector = NSSelectorFromString (@" setWeakRelatedUniqueIdentifier:" );
469- ((void (*)(id , SEL , NSString *))[attributes methodForSelector: setWeakRelatedUniqueIdentifierSelector])(attributes, setWeakRelatedUniqueIdentifierSelector, canonicalId);
480+
481+ SEL setWeakRelatedUniqueIdentifierSelector = NSSelectorFromString (@" setWeakRelatedUniqueIdentifier:" );
482+ if (canonicalId && [attributes respondsToSelector: setWeakRelatedUniqueIdentifierSelector]) {
483+ #pragma clang diagnostic push
484+ #pragma clang diagnostic ignored "-Warc-performSelector-leaks"
485+ [attributes performSelector: setWeakRelatedUniqueIdentifierSelector withObject: canonicalId];
486+ #pragma clang diagnostic pop
470487 }
471-
488+
472489 NSDictionary *userActivityIndexingParams = @{@" title" : title,
473490 @" url" : url,
474491 @" spotlightId" : spotlightIdentifier,
@@ -487,6 +504,7 @@ - (void)indexContentWithUrl:(NSString *)url spotlightIdentifier:(NSString *)spot
487504 spotlightCallback (url, spotlightIdentifier, nil );
488505 }
489506 }
507+
490508#endif
491509}
492510
0 commit comments