简体   繁体   English

在复制Xcode产品时。 为什么名称为红色,如何更改名称?

[英]On duplicating an Xcode product. Why is the name red, and how can I change the name?

I am trying to duplicate an Xcode target (Xcode 4.3.2) in order to make a free version of my iPhone App. 我正在尝试复制Xcode目标(Xcode 4.3.2),以便制作我的iPhone应用程序的免费版本。

In Xcode, I have selected the old target, right clicked, and then "duplicated". 在Xcode中,我选择了旧目标,右键单击,然后“复制”。 As a result, I got myapp copy.app and myapp copy-info.plist . 结果,我得到了myapp copy.appmyapp copy-info.plist

However, the name myapp copy.app is printed in red (even after the build). 但是,名称myapp copy.app红色打印(即使在构建之后)。 I guess it indicates that the file is missing! 我想这表明文件丢失了!

Question 1: How can I solve the above problem? 问题1:如何解决上述问题?

Question 2: How can I change the name of the new target? 问题2:如何更改新目标的名称?

I can answer Question 2. You can change the target name from the project editor. 我可以回答问题2.您可以从项目编辑器中更改目标名称。 Select your project from the project navigator on the left side of the project window to open the project window. 从项目窗口左侧的项目导航器中选择项目以打开项目窗口。 Select the target from the target list on the left side of the project editor. 从项目编辑器左侧的目标列表中选择目标。 Press the Return key to rename the target. 按Return键重命名目标。

Unfortunately when you rename the target, Xcode doesn't rename related files, such as the info.plist file. 不幸的是,当您重命名目标时,Xcode不会重命名相关文件,例如info.plist文件。 You're going to have to rename the info.plist file using the file inspector. 您将不得不使用文件检查器重命名info.plist文件。 You also have to rename the scheme Xcode created for the target. 您还必须重命名为目标创建的Xcode方案。 Click on the Scheme menu in the toolbar and choose Manage Schemes to rename the scheme. 单击工具栏中的“方案”菜单,然后选择“管理方案”以重命名方案。

After duplicating the target: 复制目标后:

  1. Select the target 选择目标
  2. Go to "Build Settings" in the right hand panel 转到右侧面板中的“构建设置”
  3. In the "Packaging" section, rename the product name and the Info.pList file 在“打包”部分中,重命名产品名称和Info.pList文件
  4. In the file explorer, rename the pList to match that set in 3 在文件资源管理器中,重命名pList以匹配3中的设置

I think the .app file becomes active (not red in color) only when you build for device. 我认为只有在为设备构建时,.app文件才会变为活动状态(不是红色)。 Change your build setting to iOS Device instead of simulator and you should see a .app created inside the Debug-iphoneos folder in the Build directory. 将您的构建设置更改为iOS设备而不是模拟器,您应该在Build目录中的Debug-iphoneos文件夹中看到.app。 HTH. HTH。

I too had an issue with red .app files in the Products folder. 我也在Products文件夹中遇到红色.app文件的问题。 I tried many of the remedies offered, but none worked. 我尝试了许多提供的补救措施,但都没有效果。 My particular issue may have been different. 我的具体问题可能有所不同。 If you have the same symptoms, my solution might work for you too. 如果您有相同的症状,我的解决方案也可能适合您。

Symptoms 症状

  1. Red .app files in the Products folder in the Navigator area (left section of xcode) 导航器区域的Products文件夹中的红色.app文件(xcode的左侧部分) 症状1
  2. When selecting the .app, the Utility area (right section of xcode) the File inspector view the “Full Path” displays: 选择.app,实用程序区域(xcode的右侧部分)时,文件检查器将显示“完整路径”:

    /Users/[user name]/Library/Developer/Xcode/DerivedData//Build/Products/Debug/[app name].app / Users / [用户名] / Library / Developer / Xcode / DerivedData // Build / Products / Debug / [app name] .app 症状2

  3. The app file is located at (note the -iphoneos after Debug) : 应用程序文件位于(注意调试后的-iphoneos)

    /Users/[user name]/Library/Developer/Xcode/DerivedData//Build/Products/Debug-iphoneos/[app name].app / Users / [用户名] / Library / Developer / Xcode / DerivedData // Build / Products / Debug-iphoneos / [app name] .app

  4. Select the following: 选择以下内容:

    a. 一种。 the project in the Navigator area (left section of xcode) (Symptom 4 - A) 导航器区域中的项目(xcode的左侧部分)(症状4 - A)

    b. the project in the Editor area (middle section of xcode) (Symptom 4 - B) 编辑区域中的项目(xcode的中间部分)(症状4 - B)

    c. C。 “Build Settings” tab (Symptom 4 - C) “构建设置”选项卡(症状4 - C)

Search for “Per-configuration Build Products Path” (Symptom 4 - D). 搜索“按配置构建产品路径”(症状4 - D)。 The value is build/Debug instead of build/Debug-iphoneos . 值为build/Debug而不是build/Debug-iphoneos 症状4

Solution

  1. Select the following: 选择以下内容:

    a. 一种。 the project in the Navigator area (left section of xcode) (Solution 1 - A) 导航器区域中的项目(xcode的左侧部分)(解决方案1 ​​ - A)

    b. the project in the Editor area (middle section of xcode) (Solution 1 - B) 编辑区域中的项目(xcode的中间部分)(解决方案1 ​​ - B)

    c. C。 “Build Settings” tab (Solution 1 - C) “构建设置”选项卡(解决方案1 ​​ - C)

  2. Set the value of “Base SDK” to Latest iOS (iOS 6.0) . 将“Base SDK”的值设置为Latest iOS (iOS 6.0) Actually any of the iOS options should work. 实际上任何iOS选项都应该有效。 (Solution 1 - D) (解决方案1 ​​ - D)

  3. Set the value of “Architectures” to Standard (armv7, armv7s) . 将“架构”的值设置为Standard (armv7, armv7s) (Solution 1 - E) (解决方案1 ​​ - E)

  4. Set the value of “Supported Platforms” to iOS (Solution 1 - F) 将“支持的平台”的值设置为iOS (解决方案1 ​​ - F) 解决方案1

Notice 注意

  1. The value for Per-configuration Build Products Path – Debug is build/Debug-iphoneos (Solution 1 - G) 每个配置构建产品路径 - 调试的值是build / Debug-iphoneos(解决方案1 ​​ - G)

  2. The .app files are no longer red. .app文件不再是红色的。 (Solution 1 – H) (解决方案1 ​​ - H)

  3. The “Full Path” for the .app is: .app的“完整路径”是:

    /Users/[user name]/Library/Developer/Xcode/DerivedData//Build/Products/Debug-iphoneos/[app name].app / Users / [用户名] / Library / Developer / Xcode / DerivedData // Build / Products / Debug-iphoneos / [app name] .app

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

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