I download Core ML model files from Apple's web page but my mac and XCode don't recognise them. Here is what I see when I add them to my project navigator:
What am I doing wrong?
I had this problem and noticed that XCode 9 Beta 4 has a bug in which every time you drag a mlmodel to your project it does not get added to the target even though you selected your target to add.
The solution is to click the file and tick the "Add to target" box located in the utilities tab. (XCode's right panel)
Related
I want to use a graph in my iPhone app. I have downloaded the source code Core- Plot for it, but now when I am trying to run it I am getting an error.
clang: error: -Z-reserved-lib-stdc++: 'linker' input unused when '-c' is present
Can anyone suggest me what this error mean or how to resolve it.
`iPhone, iPod Touch, and/or iPad Application
Dependent Project Install
Because frameworks cannot be used in Cocoa Touch applications in the same way as on the Mac, the means of including Core Plot within an iPhone application are slightly different.
First, drag the CorePlot-CocoaTouch.xcodeproj file into your iPhone application's Xcode project. Show the project navigator in the left-hand list and click on your project.
Select your application target from under the "Targets" source list that appears. Click on the "Build Phases" tab and expand the "Target Dependencies" group. Click on the plus button, select the CorePlot-CocoaTouch library, and click Add. This should ensure that the Core Plot library will be built with your application.
Core Plot is built as a static library for iPhone, so you'll need to drag the libCorePlot-CocoaTouch.a static library from under the CorePlot-CocoaTouch.xcodeproj group to the "Link Binaries With Libraries" group within the application target's "Build Phases" group you were just in.
You'll also need to point to the right header location. Under your Build settings, set the Header Search Paths to the relative path from your application to the framework/ subdirectory within the Core Plot source tree. Make sure to make this header search path recursive. You need to add -ObjC to Other Linker Flags as well (as of Xcode 4.2, -all_load does not seem to be needed, but it may be required for older Xcode versions).
Core Plot is based on Core Animation, so if you haven't already, add the QuartzCore framework to your application project.
Finally, you should be able to import all of the Core Plot classes and data types by inserting the following line in the appropriate source files within your project:
import "CorePlot-CocoaTouch.h"`
Source: core plot wiki on google
I got a solution for it here is the link.
CorePlot failed to build in XCode 4.4
Basically the issue was related to Xcode.
When you create an XCode 4 project, it asks you if you want to include unit testing. But how do you add it to a project that's been created without them?
I started a project with Unit Tests to try to figure it out, and it looks like the only difference between it and my existing project are the Test.h and Test.m files in the new project.
But when I move them into my old project and try to build, it says no such file or directory: SenTestingKit/SenTestingKit.h. That looks like a framework to me, but if I go to build phases and try to add the framework, there isn't one available called SenTestingKit :( And the new project only links the usual suspects: UIKit, CoreGraphics, and Foundation, but no SenTestingKit.
Answer updated for Xcode 10.2.
Glad you asked this question — it's never too late to add tests to a project!
Open your targets panel by selecting your project in the navigator,
Click the + button that's at the bottom of the target list,
Select iOS Unit Testing Bundle under Test section in iOS tab,
Provide the required information and click Done.
It's that simple. Xcode will generate a target, some boilerplate files such as Info.plist and an initial test case file for you. Happy testing!
Also, if you want to be able to do cmd-U to run your tests then delete the scheme that was created for the test bundle and instead edit your main application scheme and add the test bundle in the Test configuration. See this screenshot:
Xcode 7 update
Method one
File > New > Target...
Choose iOS Unit Testing Bundle. (If you want to add UI Testing then choose the UI Testing Bundle.)
Method two
Click your project name in the Project Navigator. You will see TARGETS listed. At the bottom of the screen press the plus (+) button and add the iOS Unit Testing Bundle.
The test targets in this image have already been added, but you can see where the add button is.
Related
How to do a Unit Test in Xcode
Xcode UI Test example
One more variant using Test navigator
Xcode version 10.2.1
Open Test navigator(⌘ Command + 6)
+ at the bottom
New Unit Test Target...
Choose options
Do not forget add next import to test internal[About] elements
#import "myClass.h" for Objective-C
#testable import module_name for Swift
This is pretty descriptive how-to guide:
Adding Unit Tests to an existing iOS project with Xcode 4
Some more tips to the correct answer:
In XCode 6 it is much easier now since you don't need to fix any build settings.
Change the bundle id on a test target to the correct one, if needed, by clicking the target -> Info -> Bundle Identifier.
Press CMD + U and your tests will run.
If you use CocoaPods (which is likely), you should also add Pods to the Configurations of your Project.
[Updated for Xcode 10.2]:
Open your Xcode project
Open targets
Click "Add Target" button
Go to "Test" section
Select "iOS Unit Testing Bundle"
i'm trying to read exif data for my app. i found this library, http://code.google.com/p/iphone-exif/ but can't seem to add it to my project as a framework, it adds it as a text file. does anyone know how to add it?
In Xcode 4, go to the Build Phases tab of your Target settinsg, expand the "Link Binary With Libraries" list, and drag your library there.
i have a finished application written with objective c and I would like to rename the file. how do i do that?
Recent versions of Xcode have a "Rename..." item in the Project menu.
Renaming a project has changed in Xcode 4+. (Kris Markel's answer above is for Xcode 3.2.x )
Follow these steps to rename your application in Xcode 4.0 or later:
In Xcode, select your target under "Targets" in the project editor, then choose View > Utilities > Show File Inspector.
Xcode opens the file inspector pane. Enter your application's new name in the Project Name field as shown in Figure 1, then hit the return key on your keyboard.
Xcode displays a project-rename dialog that contains all the items that can be renamed in your project. Leave your application selected in the dialog and deselect all other items as shown in Figure 2, then click Rename to perform the rename operation.
Source: iOS Developer Library Technical Q&A QA1625
No biggie, but when I add the AVFoundation framework for the iPhone, it turns red for some reason I'm unable to figure out why. The project will not compile unless I add this framework, and if I do, Xcode will mark the framework red (apparently that means xcode cannot find the framework), but yet it will work.
This is quite annoying. Any clue what I might be doing wrong here?
Try adding AVFoundation framework via your target.
Look for your target under "Groups and Files"
"Get Info" for it
Click the "General" tab
At the bottom right of the window click the "+" button
At the top of your list you should find AVFoundation, add it.
close Xcode
delete your project
shut down your mac
take the mac back to your boss and tell him it's not working
wait until they figure out what it is
if this doesn't work, find a new job that doesn't require the use of a mac
All I had to do was open up the "General" settings tab for the project and change the "Base SDK for All Configurations" value. It was set to an SDK that I no longer had installed.