Charts: Le type 'NSAttributedStringKey' (alias 'NSString') n'a pas de membre 'font'

Créé le 22 sept. 2017  ·  12Commentaires  ·  Source: danielgindi/Charts

Lors de la mise à jour des graphiques vers 3.0.4, cette erreur est obtenue dans Xcode 9.

Les autres erreurs sont :

  1. Étiquette d'argument incorrecte dans l'appel (avoir 'withAttributes:', attendu 'attributes:')
  2. Impossible de convertir la valeur de type '[NSAttributedStringKey : Any]?' (alias 'Facultatif>') au type d'argument attendu '[String : Any]?'

Commentaire le plus utile

J'ai aussi remarqué cela. Je le corrige en définissant la version de swift sur 4.0 dans les paramètres de construction des graphiques dans xcode
screen shot 2017-09-22 at 09 42 09

Tous les 12 commentaires

Je suis également confronté à des erreurs dans la plupart des classes Charts après la mise à jour vers 3.0.4

Étiquette d'argument incorrecte dans l'appel (avoir 'withAttributes:', attendu 'attributes:')

J'ai aussi remarqué cela. Je le corrige en définissant la version de swift sur 4.0 dans les paramètres de construction des graphiques dans xcode
screen shot 2017-09-22 at 09 42 09

Je l'ai aussi corrigé. Merci

comment corriger dans un projet ObjectiveC ?

il devrait avoir la balise @objc à utiliser, alors mettez à jour votre code

attributs : [NSFontAttributeName : label.font]

Pour Swift 3, utilisez pod 'Charts','= 3.0.3'

Je suppose que cela devrait être corrigé dans ce cadre.

Au fait, si vous utilisez des pods :

  1. Sélectionnez le projet Pods dans la visionneuse la plus à gauche de Xcode.
  2. Sélectionnez la cible Graphiques.
  3. Paramètres de construction
  4. Version en langage Swift

J'ai rencontré ce problème avec v. 3.1.1 , j'utilise Swift 4.1

let att : [NSAttributedStringKey : Any] = [

        NSAttributedStringKey(rawValue:

NSAttributedStringKey.font.rawValue) : UIFont.italicSystemFont(ofSize : 15.0
),

        NSAttributedStringKey(rawValue:

NSAttributedStringKey.foregroundColor.rawValue) : Const.colorBlue500,

        NSAttributedStringKey(rawValue:

NSAttributedStringKey.underlineStyle.rawValue) : 1]

    let attributeString = NSMutableAttributedString(string:

"open_accessory_sheet".localize,

                                                    attributes: att)

Pour rapide 4 .
tu peux essayer de l'utiliser

Vào Je 7, 9 thg 6, 2018 vào lúc 02:43 Jose Manuel Vergara Florez <
[email protected]> ã viết :

J'ai rencontré ce problème avec la v. 3.1.1, j'utilise Swift 4.2

-
Vous recevez ceci parce que vous avez commenté.
Répondez directement à cet e-mail, consultez-le sur GitHub
https://github.com/danielgindi/Charts/issues/2816#issuecomment-395868392 ,
ou couper le fil
https://github.com/notifications/unsubscribe-auth/AMLGfjdadIXdyF4cgGGTCaYMQs1sz9CDks5t6tPcgaJpZM4PgNRb
.

let att : [NSAttributedStringKey : Any] = [
NSAttributedStringKey(rawValue : NSAttributedStringKey.font.rawValue) : UIFont.italicSystemFont(ofSize : 15.0),
NSAttributedStringKey(rawValue : NSAttributedStringKey.foregroundColor.rawValue) : Const.colorBlue500,
NSAttributedStringKey(rawValue : NSAttributedStringKey.underlineStyle.rawValue) : 1]
let attributeString = NSMutableAttributedString(string : "open_accessory_sheet".localize,
attributs : att)

Cette page vous a été utile?
0 / 5 - 0 notes

Questions connexes

ahmedsafadii picture ahmedsafadii  ·  3Commentaires

anhltse03448 picture anhltse03448  ·  3Commentaires

kirti0525 picture kirti0525  ·  3Commentaires

guoyutaog picture guoyutaog  ·  3Commentaires

Bharati555 picture Bharati555  ·  4Commentaires