2015-04-11 1 views
0

Après mise à niveau vers Xcode 6.3, je reçois maintenant cet avertissement:Avertissement: définition de fonctions dans un objet Objective-C est dépréciée

Warning: Function definition inside an Objective-C object is deprecated 

L'avertissement apparaît dans une catégorie sur NSString, où je suis défini une méthode UIKIT_STATIC_INLINE.

est ici le code incriminé:

// NSString+Helpers.h 
#import <Foundation/Foundation.h> 

@interface NSString (Helpers) 

+ (BOOL)exampleCategoryMethod; 

UIKIT_STATIC_INLINE NSString *NSStringFromCLLocationCoordinate2D(CLLocationCoordinate2D coordinate) { 
    return [NSString stringWithFormat:@"%f,%f", coordinate.latitude, coordinate.longitude]; 
} 

@end 

Répondre

5

Je devais simplement déplacer ma définition de la fonction en ligne statique en dehors de mon @interface.

Voici le code modifié:

// NSString+Helpers.h 
#import <Foundation/Foundation.h> 

UIKIT_STATIC_INLINE NSString *NSStringFromCLLocationCoordinate2D(CLLocationCoordinate2D coordinate) { 
    return [NSString stringWithFormat:@"%f,%f", coordinate.latitude, coordinate.longitude]; 
} 

@interface NSString (Helpers) 

+ (BOOL)exampleCategoryMethod; 

@end