I want to add Crashlytics plugin to my iOS project that demands to add Run script phase. But no matter what I do - for add build phase all options are disabled:
I select Target -> Build Phases
I have proper scheme
My project runs well - no issues,
I run Xcode 6
I answer on my question because took me time to find right solution.
Its really strange that the same issue migrates from old versions to XCode 7+.
I found solution in one of the comments of similar problem:
how-to-add-a-copy-files-build-phase-to-my-target (credits to #Paul Solt)
Its a bug, when user selects Build Pahses tab, XCode doesn't see that.
Solution
select Target -> Build Phases
After, click on any area under search form or better way, just open Target Dependencies drop down
Editor -> Add Build Phase
I hope it will save time to someone instead to read comments ;)
The upvoted solution did not work for me but there is another - even though the "Editor->Add Build Phase" is grayed out the small "+" in the top left of the "Build Phases" pane is not, and it works.
So select the project in the project navigator
Select the target
Select "Build Phases" in the top bar of the content pane
Click the "+" symbol in the top left of the "Build Phases" pane
Maxims answer did not work for me.
I had the same problem and solved it as follows and I opened a bug against apple: issue 22516266 on https://bugreport.apple.com
Here is how I solved the issue for me:
1.) Edit Scheme ...
2.) In the relevant phase of the schema you can add scripts as Pre-Actions or Post-Action, where you will find "New Run Script Action"
I think you pretty much create any workflow you like with this.
Hope that helps.
Related
With XCode 6.4 I could easily clone an existing target. However this functionality doesn't seem to be available in XCode 8.x.
Does anyone know how to do it?
Select your target, right-click on it, then select Duplicate.
As you can see - the project now has 2 targets:
I could not figure out what I was missing. The above answer is missing a step. The panel where you can duplicate targets is probably hidden.
Click the side panel button to see the targets.
Now you can see the targets and right click to duplicate, then just click on the name and rename it. Much easier.
I'm having a problem. I'm trying to implement Amazon frameworks in my ios xcode project and I also need to add them in Build Phases > Embed Frameworks section. But there is no option in my xcode window. Here is the screenshot
How is this possible. The problem remains even if I create new project.
Hello in your general Tab with your target selected check for section named
Embedded Binaries
I hope this help you
Another reason Embedded Binaries tab doesn't show up in Xcode is if you're in a command line project instead of a cocoa project and you're targeting Mac OS X.
You can create it on Build Phases tab!
Just click in the "+" icon and select "New Copy Files Phase". After that, rename the item created to "Embed Frameworks" and set the "Destination" field to "Frameworks".
You can tap the General tab to see those sections.
As an aside, using CocoaPods or Fabric will make that integration easier on you.
The Xcode Test navigator shows a list of test case classes.
I want to delete a test case class because it's no longer needed.
I've tried many typical approaches, such as pressing delete, or looking for a "-" icon, or "Remove" menu item, or searching for help in Apple Xcode documentation.
I've found this workaround:
In the Project navigator, remove the file from the project and delete the file.
Quit Xcode and re-launch it. The Test navigator seems to lose track of the test classes and test cases, and show zero items.
Run the tests. The Test navigator seems to rebuild the list of test classes and test cases.
If that still doesn't work, try these...
Delete Xcode Derived Data:
Xcode menu -> Preferences -> "Locations" icon -> "Derived Data" section.
Click the tiny gray circle arrow; this opens the Finder and shows the DerviedData folder.
Delete the entire folder.
Rebuild:
Product menu -> Clean.
Product menu -> Build.
Is there a simpler way to accomplish the goal of deleting a test class? Ideally without needing to relaunch Xcode, or rebuild the project, etc.?
Related kind of issue: How can I delete Xcode test cases from the test case view?
I'm using Xcode 6.3 and Swift 1.2, if that helps to know.
Edit: In the comments, #CouchDeveloper points to the official Xcode 6.3 release notes, which describe a known bug # 20373533:
Swift tests are not automatically discovered in this release of Xcode. Test annotations in the source editor sidebar will not appear, and the test navigator and the table of tests in the Test action of the scheme sheet will be empty. ...
The bounty on this question is for any solution or better workaround. Any workaround is fine, such as using the Xcode GUI, or using command-line xcodebuild, or any shell script that kludges the project files.
If you want to delete just a single test class, you can click on the file name in the Project Navigator and press Delete and Move to Trash.
If you want to delete then entire Testing bundle, click your project name in the Project Navigator. Then select your Tests target. Click the minus (-) button at the bottom to delete it.
It is a good idea to do Unit Testing (and UI testing) in your projects. So if you want to add them back in then just click the plus (+) button.
See also
How to do a Unit Test in Xcode
Xcode UI Test example
Using Xcode 6.2, all I had to do was to switch to the Project navigator, select the file, and press delete. I then clicked the "Remove Reference" button in the confirmation dialog that appears. After that, the tests in that file disappeared from the Test navigator immediately. Adding the file back, the tests reappeared.
I didn't have any need to delete the derived data folder, restart Xcode, etc.
Adding the file to the project again instantly restored the tests in the Test navigator.
This is certainly the desired behavior, and it sounds like it's broken in Xcode 6.3 but possibly fixed again in 6.3.1. So the real answer may just be that you need to upgrade to 6.3.1 (or downgrade to 6.2).
Before:
After:
You can add and remove tests to the project easily using the class target membership checkbox. Find the class file in the Project Navigator and select it, then in the Utilities pane, click on the File Inspector and you will see a checkbox for target membership. You can toggle it on and off in there.
I am trying to include SVGKit (https://github.com/SVGKit/SVGKit) into a test project.
And I get the message:
"libxml/parser.h file not found"
I have checked that the file indeed does not exist on the file system under the project folder.
Neverthe less the demo provided works fine.
Can someone tell me what is going on?
I think you'll need to link libxml to your project. As explained in steps 10 and 11 of "Cross Platform Library Build" on the github page you linked to, just go to Build settings in Xcode, search for "header search paths", double click on it, press the "+" button in the popover, type "/usr/include/libxml2" and make sure "recursive" is selected in the popup button, as I think everything is within yet another subdirectory.
Then add the framework "libxml2.dylib" to "Linked Frameworks and Libraries".
This should fix your problem.
First add libxml2.dylib into your framework
Then go to Project -> Build Settings and search for "Header Search Paths" key and add this value: "${SDK_DIR}"/usr/include/libxml2 don't forget select "all" for Build settings
I am working on Xcode 4.3.2 i wanted to rename my classes so i used refactor>rename, but after that i changed my mind and decided to go back to the older name. But when i do the same thing i've done before again, a warning dialog appears saying:
yourclass.h is not part of the build phase of any targets in this workspace and so can't be refactored. add the file to the build phase of a target in this workspace, or make a selection in another file.
what's the build phase? how can i solve this problem?
Thank you very much
It may be worthwhile to delete the projects derived data
Organizer --> Projects --> hit the delete derived data button for the project in question
Quit XCode
Open XCode
Build project. This will re-index your project and has been known to fix various environment issues such as
code sense
auto complete and
copmpiler targets
In Xcode, select your project at the top of the file tree on the left hand side.
From there, select your target, and click the "Build Phases" tab. Make sure the .m file of the class you're wanting to rename is listed under "Compile Sources"
You could check if you have the file here:
Targets => Select the target which is the select target your scheme is trying to run => Tab Build Phases => Compile Sources
Check if there is something wrong there (like file in red).
xCode usually takes snapshots when you rename the classes through the re-factor option .. you can go to File > restore SnapShote .. and choose the snapshot you want retrieve to and you will get back all the changed names.
In my case the .m file was under the compile sources. I did clear the project derived data and restarted xcode but to no avail.
I figured out though, that attempting to refactor the specific property in the .m file worked and renamed the property both in the header and the rest of the project references.