Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

221
Visualizações
Swift 4.2 falla en NSAttributedString.Key.writingDirection

Tengo este código en mi aplicación iOS:

 let subAttr: [NSAttributedString.Key : Any] = [NSAttributedString.Key.font : font, NSAttributedString.Key.foregroundColor : color, NSAttributedString.Key.writingDirection : NSWritingDirection.leftToRight]

Esto está causando un bloqueo:

 2019-01-24 18:12:04.425440+0300 Haraj[5461:1355738] -[_SwiftValue count]: unrecognized selector sent to instance 0x281c752f0 2019-01-24 18:12:04.425619+0300 Haraj[5461:1355738] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[_SwiftValue count]: unrecognized selector sent to instance 0x281c752f0' *** First throw call stack: (0x1f5327ef8 0x1f44f5a40 0x1f523f154 0x1f532d810 0x1f532f4bc 0x1f525b954 0x1f90f5e3c 0x1f90f5cf4 0x1f9049030 0x1f9048fb8 0x1f9003050 0x1f9016e28 0x1f9016b6c 0x1f9004070 0x1ff8d7e2c 0x1ff956e38 0x1ff8dc0b0 0x221be3e24 0x221be446c 0x222536c4c 0x22253740c 0x222537068 0x222541210 0x221be38f0 0x22253fd50 0x222540200 0x2225400d4 0x1f5cc551c 0x22254045c 0x2225400d4 0x2225409a4 0x2225405c4 0x2225415e4 0x2225e7e90 0x2225fbfa8 0x1f9909a34 0x1f990e9c4 0x2225e7430 0x2225edfe0 0x22237e130 0x22237e478 0x222349bfc 0x222367ae8 0x2225fbf44 0x1f9909a34 0x1f990e9c4 0x2225e7430 0x221b019bc 0x221afc0b0 0x221afa280 0x2225b7314 0x2225b75d0 0x2225c5490 0x2225c0ecc 0x2225b7058 0x221b027cc 0x221b02da8 0x221b040a8 0x221ae6298 0x2225fbf44 0x1f9909a34 0x1f990e9c4 0x1f986d9d4 0x1f989c2f4 0x222181bf4 0x1f52b5b94 0x1f52b0828 0x1f52b0dc8 0x1f52b05b8 0x1f7524584 0x222158bc8 0x10257be3c 0x1f4d70b94) libc++abi.dylib: terminating with uncaught exception of type NSException (lldb) po 0x281c752f0 __C.NSWritingDirection (lldb)

Esto funcionaba bien en Swift 3 , pero recientemente migré a Swift 4.2 . ¿Alguna ayuda?

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

La documentación para NSAttributedString.Key.writingDirection dice:

El valor de este atributo es un objeto NSArray que contiene objetos NSNumber que representan los niveles anidados de anulaciones de dirección de escritura, en orden de más externo a más interno.

Este atributo proporciona un medio para anular el algoritmo de texto bidireccional predeterminado, equivalente al uso de los caracteres de control bidi Unicode LRE, RLE, LRO o RLO combinados con PDF, pero como un atributo de nivel superior. (Consulte el anexo n.º 9 estándar de Unicode para obtener información sobre los códigos de formato bidi de Unicode). La constante NSWritingDirectionAttributeName es un atributo de nivel de carácter que proporciona una alternativa de nivel superior a la inclusión de caracteres de control bidireccionales explícitos en el texto. Es el equivalente NSAttributedString del marcado HTML usando el elemento bdo con el atributo dir.

Los valores de los objetos NSNumber deben ser 0, 1, 2 o 3 para LRE, RLE, LRO o RLO respectivamente, y combinaciones de NSWritingDirection.leftToRight y NSWritingDirection.rightToLeft con NSTextWritingDirectionEmbedding o NSTextWritingDirectionOverride , como se muestra en la Tabla 1.

Como mínimo, debe proporcionar una matriz:

 let subAttr: [NSAttributedString.Key : Any] = [ .font : font, .foregroundColor : color, .writingDirection : [ NSNumber(value: NSWritingDirection.leftToRight.rawValue) ] ]
over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda