Charts: O tipo 'NSAttributedStringKey' (também conhecido como 'NSString') não possui 'fonte' de membro

Criado em 22 set. 2017  ·  12Comentários  ·  Fonte: danielgindi/Charts

Quando atualizado Charts para 3.0.4 obtendo este erro no Xcode 9.

Outros erros são:

  1. Rótulo de argumento incorreto na chamada (tem 'withAttributes:', esperado 'atributos:')
  2. Não é possível converter o valor do tipo '[NSAttributedStringKey: Any]?' (também conhecido como 'Opcional> ') para o tipo de argumento esperado' [String: Qualquer]? '

Comentários muito úteis

Eu também percebi isso. Eu conserto definindo a versão do swift para 4.0 nas configurações de compilação de gráficos no xcode
screen shot 2017-09-22 at 09 42 09

Todos 12 comentários

Também estou enfrentando erros na maioria das classes de gráficos depois de atualizar para 3.0.4

Rótulo de argumento incorreto na chamada (tem 'withAttributes:', esperado 'atributos:')

Eu também percebi isso. Eu conserto definindo a versão do swift para 4.0 nas configurações de compilação de gráficos no xcode
screen shot 2017-09-22 at 09 42 09

Eu também consertei. Obrigada

como consertar em um projeto ObjectiveC?

deve ter a tag @objc para usar, então atualize seu código

atributos: [NSFontAttributeName: label.font]

Para Swift 3, use pod 'Charts','= 3.0.3'

Eu acho que isso deve ser corrigido neste quadro.

A propósito, se estiver usando pods:

  1. Selecione o projeto Pods no visualizador mais à esquerda no Xcode.
  2. Selecione o alvo dos gráficos.
  3. Configurações de compilação
  4. Versão em linguagem Swift

Encontrei este problema com v. 3.1.1 , estou usando Swift 4.1

deixe 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)

Para o Swift 4.
você pode tentar usá-lo

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

Tive esse problema com a v. 3.1.1, estou usando o Swift 4.2

-
Você está recebendo isso porque comentou.
Responda a este e-mail diretamente, visualize-o no GitHub
https://github.com/danielgindi/Charts/issues/2816#issuecomment-395868392 ,
ou silenciar o tópico
https://github.com/notifications/unsubscribe-auth/AMLGfjdadIXdyF4cgGGTCaYMQs1sz9CDks5t6tPcgaJpZM4PgNRb
.

deixe 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,
atributos: att)

Esta página foi útil?
0 / 5 - 0 avaliações