How to recreate a deleted target?

前端 未结 2 2030
再見小時候
再見小時候 2021-01-14 15:43

I have deleted my application target and now all my Build option are gone. I cannot run my project because I am missing a target. How can I regenerate it?

2条回答
  •  旧时难觅i
    2021-01-14 16:12

    If restoring from a backup or a repository is not an option, and your bundle has many resources, I'd recommend starting a new XCode project from scratch and importing the source files and resources into it.

    1. Create a new Xcode project of the same type and info as your project.
    2. Delete this new project's ViewController and AppDelegate source files, copy your source files into the new project's folder, then import them into the Xcode project.
    3. Add any frameworks you've used.
    4. Import the resources (images, sounds, plists, etc) into the project.

    It might take longer than recreating a target and adding things to it, but you're less likely to make mistakes along the way, and you'll ensure that everything is properly added to the target.

提交回复
热议问题