最新消息:20210816 当前crifan.com域名已被污染,为防止失联,请关注(页面右下角的)公众号

[已解决]swift的app的中文名内部调试输出时显示乱码

Swift crifan 4612浏览 0评论

之前将app名字改为中文名了:

[已解决]swift中把app的名字从英文名改为中文名

但是调试期间,发现输出的app的名字却是乱码:

contactItem=<ÁÆÄÈÅì.PersonItem: 0x129c5d540>
2016-03-31 21:56:33.063 [Debug] [NSOperationQueue 0x127e20cd0 :: NSOperation 0x12977ef60 (QOS: LEGACY)] [ConversationUtility.swift:513] getContactItemFromCache > savedContactItem=Optional(<ÁÆÄÈÅì.UserItem: 0x127d14da0>)

其中的:

ÁÆÄÈÅì

就是

简道

 swift app chinese character messy code

 swift app name

iphone – Localize iOS App Name in Swift – Stack Overflow

Technical Q&A QA1823: Updating the Display Name of Your App

Renaming a Project or App

 swift app target name

 ios app target name localize

ios – Localized project with several targets with localized app names – Stack Overflow

 ios app localize target name

Managing Strings Files Yourself

Internationalization and localization of Apps in Xcode 6 and Swift

[已解决]swift中给app名称和项目名称添加多国语言本地语言支持

再去看看log中app名字是否有乱码了

就没有了,都是英文名JianDao了:

2016-04-01 11:53:43.800 [Debug] [main] [GlobalValues.swift:266] setNaviRootVC > rootVC=<JianDao.LoginViewController: 0x13fd48d80>

后来想起来了:

之前就是对于生成的app中的名字,是乱码:

之前的是:

            <BuildableReference
               BuildableIdentifier = "primary"
               BlueprintIdentifier = "984AE8191BDF299400B5E8DB"
               BuildableName = "JianDao.app"
               BlueprintName = "JianDao"
               ReferencedContainer = "container:JianDao.xcodeproj">
            </BuildableReference>
      <MacroExpansion>
         <BuildableReference
            BuildableIdentifier = "primary"
            BlueprintIdentifier = "984AE8191BDF299400B5E8DB"
            BuildableName = "JianDao.app"
            BlueprintName = "JianDao"
            ReferencedContainer = "container:JianDao.xcodeproj">
         </BuildableReference>
      </MacroExpansion>
      <BuildableProductRunnable
         runnableDebuggingMode = "0">
         <BuildableReference
            BuildableIdentifier = "primary"
            BlueprintIdentifier = "984AE8191BDF299400B5E8DB"
            BuildableName = "JianDao.app"
            BlueprintName = "JianDao"
            ReferencedContainer = "container:JianDao.xcodeproj">
         </BuildableReference>
      <BuildableProductRunnable
         runnableDebuggingMode = "0">
         <BuildableReference
            BuildableIdentifier = "primary"
            BlueprintIdentifier = "984AE8191BDF299400B5E8DB"
            BuildableName = "JianDao.app"
            BlueprintName = "JianDao"
            ReferencedContainer = "container:JianDao.xcodeproj">
         </BuildableReference>
      </BuildableProductRunnable>

现在是:

            <BuildableReference
               BuildableIdentifier = "primary"
               BlueprintIdentifier = "984AE8191BDF299400B5E8DB"
               BuildableName = "简道.app"
               BlueprintName = "JianDao"
               ReferencedContainer = "container:JianDao.xcodeproj">
            </BuildableReference>
     <MacroExpansion>
         <BuildableReference
            BuildableIdentifier = "primary"
            BlueprintIdentifier = "984AE8191BDF299400B5E8DB"
            BuildableName = "简道.app"
            BlueprintName = "JianDao"
            ReferencedContainer = "container:JianDao.xcodeproj">
         </BuildableReference>
      </MacroExpansion>
     <BuildableProductRunnable
         runnableDebuggingMode = "0">
         <BuildableReference
            BuildableIdentifier = "primary"
            BlueprintIdentifier = "984AE8191BDF299400B5E8DB"
            BuildableName = "简道.app"
            BlueprintName = "JianDao"
            ReferencedContainer = "container:JianDao.xcodeproj">
         </BuildableReference>
      </BuildableProductRunnable>
      <BuildableProductRunnable
         runnableDebuggingMode = "0">
         <BuildableReference
            BuildableIdentifier = "primary"
            BlueprintIdentifier = "984AE8191BDF299400B5E8DB"
            BuildableName = "简道.app"
            BlueprintName = "JianDao"
            ReferencedContainer = "container:JianDao.xcodeproj">
         </BuildableReference>
      </BuildableProductRunnable>

-》

然后折腾:

[已解决]swift中给app名称和项目名称添加多国语言本地语言支持

后又改回英文,但是添加了本地化locallization支持,就不会有乱码了。

-》

其实就是:

BuildableName

的事情,之前直接改为中文,结果导致乱码了。。。

-》

看来是Xcode的Scheme中,虽然加了UTF-8,支持unicode,但是实际上没有支持。。。

转载请注明:在路上 » [已解决]swift的app的中文名内部调试输出时显示乱码

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
84 queries in 0.191 seconds, using 22.01MB memory