首页 文章

在Xcode 6中重命名应用程序

提问于
浏览
20

我有一个应用程序,我需要重命名,所以代码可以重复使用只有轻微的变化,我有困难 .

我按照这个链接,似乎覆盖它,但当我尝试构建它时,我收到一个链接错误,其中也是如下:

链接到资源:

http://matthewfecher.com/app-developement/xcode-tips-the-best-way-to-change-a-project-name-in-xcode/

这是我得到的链接错误和我看到的信息

Ld /Users/jeffjanes/Library/Developer/Xcode/DerivedData/solfEightFive-aqlpurtbbyfkqmgjdryrxicllljh/Build/Products/Debug-iphoneos/solfEightFiveTests.xctest/solfEightFiveTests normal arm64
    cd "/Users/jeffjanes/Xcode Projects/solfEightFive/shell"
    export IPHONEOS_DEPLOYMENT_TARGET=8.0
    export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch arm64 -bundle -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.0.sdk -L/Users/jeffjanes/Library/Developer/Xcode/DerivedData/solfEightFive-aqlpurtbbyfkqmgjdryrxicllljh/Build/Products/Debug-iphoneos -F/Users/jeffjanes/Library/Developer/Xcode/DerivedData/solfEightFive-aqlpurtbbyfkqmgjdryrxicllljh/Build/Products/Debug-iphoneos -F/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.0.sdk/Developer/Library/Frameworks -F/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/Frameworks -F/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.0.sdk/Developer/Library/Frameworks -filelist /Users/jeffjanes/Library/Developer/Xcode/DerivedData/solfEightFive-aqlpurtbbyfkqmgjdryrxicllljh/Build/Intermediates/solfEightFive.build/Debug-iphoneos/solfEightFiveTests.build/Objects-normal/arm64/solfEightFiveTests.LinkFileList -Xlinker -rpath -Xlinker @executable_path/Frameworks -Xlinker -rpath -Xlinker @loader_path/Frameworks -dead_strip -bundle_loader /Users/jeffjanes/Library/Developer/Xcode/DerivedData/solfEightFive-aqlpurtbbyfkqmgjdryrxicllljh/Build/Products/Debug-iphoneos/shell.app/shell -framework XCTest -fobjc-arc -fobjc-link-runtime -miphoneos-version-min=8.0 -Xlinker -dependency_info -Xlinker /Users/jeffjanes/Library/Developer/Xcode/DerivedData/solfEightFive-aqlpurtbbyfkqmgjdryrxicllljh/Build/Intermediates/solfEightFive.build/Debug-iphoneos/solfEightFiveTests.build/Objects-normal/arm64/solfEightFiveTests_dependency_info.dat -o /Users/jeffjanes/Library/Developer/Xcode/DerivedData/solfEightFive-aqlpurtbbyfkqmgjdryrxicllljh/Build/Products/Debug-iphoneos/solfEightFiveTests.xctest/solfEightFiveTests

ld: file not found: /Users/jeffjanes/Library/Developer/Xcode/DerivedData/solfEightFive-aqlpurtbbyfkqmgjdryrxicllljh/Build/Products/Debug-iphoneos/shell.app/shell
clang: error: linker command failed with exit code 1 (use -v to see invocation)

有什么我想念的吗?我试过清理它,似乎没有效果 .

这只是一些澄清,上面链接中描述的过程建议如下:

在屏幕左上角的项目导航器窗格中,轻轻双击项目名称 . 然后允许Xcode重命名文件

以相同的方式重命名方案

这就是我所做的一切,也许这本身就不够,所以如果有人知道正确的方法,请告诉我 .

6 回答

  • 0

    我最近也遇到过这个问题 . 您的XCode项目应该有两个目标 . 您的应用程序的一个目标是测试的另一个目标 .

    在测试目标的构建设置中,有一个设置名称Test Host . 重命名应用目标后,此设置的值不会更新 .

    正确修改测试主机设置值,一切都应该工作 .

  • 0

    我通过使用文本编辑器打开MyProject.xcodeproj / project.pbxproj并手动替换错误的名称(* .app)解决了这个问题 .

  • 1

    首先,我试图仅将其作为评论发布,但我不允许这样做 .

    我不太了解Xcode 6,但是因为我假设它使用的每个项目文件都是基于文本的,你可以在shell中尝试这样的东西,假设 MyProjectDir 是你的项目目录而 OldProjectName 是你项目的旧名称 .

    您应该先在Xcode中清理并关闭项目 .

    cd MyProjectDir
    find . -type f -exec grep -i OldProjectName {} \; -ls
    

    这将列出包含旧项目名称的行的所有文件(每个文件首先包含匹配的行,然后是“ls -l”格式的包含文件的目录条目) . 这样,您至少应该知道哪些文件仍包含旧名称 . 也许使用文本编辑器改变它可以完成这项工作 .

    你也可以

    cd MyProjectDir
    find . -iname "*OldProjectName*" -ls
    

    列出包含旧项目名称的所有文件 . 然后,如果您确定它们是由Xcode生成的,您可以重命名这些文件,甚至删除它们 .

    Of course, be sure to make a backup copy of your project first!

  • 2

    我看起来是同样的问题 .

    我通过以下方式解决了

    • 导航到问题目录:在你的情况下:shell.app .

    • mv shell OLD_NAME . 换句话说:将文件重命名为项目的旧名称 .

    • 清洁运行

  • 4

    造成这种情况的原因是对旧应用产品的挥之不去的引用 . 您需要删除 Derived Data 文件夹并执行清理 . 你应该在那之后全力以赴 . 有关更多信息,请参阅此链接:

    Delete Derived Data

  • 12

    在Xcode 7中,重命名CocoaTouch Framework项目后,我必须管理Schemes,然后单击“Autocreate Schemes Now”按钮 . 然后我删除了原始名称的方案 .

相关问题