简体   繁体   English

iOS BundleId允许的最大长度是多少?

[英]What is maximum allowed length of iOS BundleId?

I am trying to come up with regex to validate iOS app's bundle id. 我正在尝试使用正则表达式来验证iOS应用程序的包ID。 This link was quite helpful. 这个链接非常有用。 However I also need to validate length of supplied bundleid as well as length of strings between dots (here I am assuming there would be such restrictions from Apple) . 但是我还需要验证提供的bundleid的长度以及点之间的字符串长度(这里我假设Apple会有这样的限制)。 For example, in bundle id 'com.company.project' I need to ensure 'company', 'project' etc are also within in allowed limit. 例如,在bundle id'com.company.project'中,我需要确保'company','project'等也在允许的限制范围内。 I tried finding any apple docs that talks about maximum allowed bundle id but I couldn't. 我尝试找到任何谈论最大允许捆绑ID的苹果文档,但我不能。 Is it like any length is allowed? 是否允许任何长度? Any help appreciated. 任何帮助赞赏。

Apparently 155 characters. 显然是155个字符。

Checked in Apple Developer Account as seen below: 在Apple Developer Account中查看,如下所示:

BundleID

Also, it could be one long character set without .'s 此外,它可能是一个没有。的长字符集

From inspecting the HTML of the create App ID page on May 14, 2018, here are the constraints including a regular expression to validate the bundle identifier: 从2018年5月14日检查创建应用程序ID页面的HTML开始,以下是约束,包括用于验证包标识符的正则表达式:

Name 名称

  • Maximum Length: 50 最大长度:50
  • Pattern: ^[0-9A-Za-z\\d\\s]+$ 模式: ^[0-9A-Za-z\\d\\s]+$

Bundle Identifier 捆绑标识符

  • Maximum Length: 155 最大长度:155
  • Pattern: ^[A-Za-z0-9\\.\\-]+$ 模式: ^[A-Za-z0-9\\.\\-]+$

The original question was a regular expression to validate bundle identifiers, you could use this to do that: 原始问题是验证包标识符的正则表达式,您可以使用它来执行此操作:

^[A-Za-z0-9\.\-]{1,155}$

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM