I using CoreML with Swift 4.0 on Xcode 9 Beta.
I downloaded Inception v3.mlmodel files from WWDC
I get the errors Use of unresolved identifier 'InceptionV3' and Use of undeclared type 'InceptionV3'
And i download some sample projects and also getting same problem with that downloaded projects.
Now what can i do ?
Thanks
InceptionV3 is auto generated when you drag and drop the .mlmodel file to your project. Try remove the reference to that file and drag and drop again. Also ensure the target in Target Membership is selected (select the .mlmodel and look at the right panel).
Related
I have an iOS Swift project with multiple targets.
Converting the first target to Swift 5 was easy.
Converting the second target to Swift 5, Xcode 10.2 tries to compile files that clearly exist only in the first target and fails (Because it doesn't compile all files of the first target and complains about unresolved identifiers).
What can I do that Xcode compiles only those files, that are part of the target while converting to Swift 5?
How can I convert my project to Swift 5?
Cleaning the Build folder and restarting Xcode 10.2 doesn't help.
I just went through this process and was able to figure out a fairly simple solution from a hint in the last sentence of the Migration Guide https://swift.org/migration-guide-swift5/
When I tried to convert each target individually in my project, the second target would fail because of shared code with the first target that had already been converted. The solution is to create a new scheme that includes all of the targets that need to be migrated in a single pass.
Click on the scheme button to get the drop down and select "New Scheme..."
Create the scheme and then select it in the drop down and choose "Edit Scheme..."
Under the "Build" section use the "+" button to add all of the targets you need to convert to the scheme.
Build the new scheme with the current Swift version to confirm that all targets build correctly.
Use Edit -> Convert -> "To Current Swift Syntax..." to start the conversion
This worked for me in a project with 15 targets with lots of shared Swift code that was in version 4.0.
I found a workaround:
reset project to state before conversion.
convert the target with the fewest classes (not containing the files in the error message of the first attempt)
convert target for target, including more and more files
convert test targets
With this approach I was able to convert my project.
(See also the comment of Cœur, I think their manual conversion would work, too)
It's not clear to me what the issue is, if you could file a bug report at http://bugreport.apple.com, the team at Apple will follow-up with you.
Note that there is a migration guide that you may find helpful here: https://swift.org/migration-guide-swift5
If I understand correctly. You've got one target migrated correctly and another is stuck on the older swift. I had a similar situation, click on the target, go to 'Build Settings', search for 'swift' and then manually change the 'Swift Language Version' to 5. Then since you've already converted the code, it should just compile.
I have downloaded this https://github.com/MichelDeiman/Programming-Project-4_-Smashtag-Mentions Twitter project to use the Twitter.framework it comes with. When I open it from the download, it loads fine. However, when I move the Twitter.xcodeproj to my Xcode workspace, it turns the framework red and doesn't allow me to use it.
I have searched for a solution and think it has to do with finding the correct path for the framework but have been unsuccessful. Any thoughts?
Red means it hasn't been built yet. I suspect you can't use it because it hasn't been imported in the Build settings. I'd check there first. If it's imported correctly then it should built when you build the targets that refer to it.
This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
How to get rid of the warning “file was built for unsupported file format” when linking with a static library?
I write #import <AVFoundation/AVFoundation.h> in my code but when i compile it gives the following error: 'AVFoundation/AVAsset.h' file not found
Also I got following warning:
ld: warning: ignoring file /Volumes/Xcode/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk/System/Library/Frameworks//AVFoundation.framework/AVFoundation, file was built for unsupported file format which is not the architecture being linked (armv7)
Kindly help
You have to add the AVFoundation framework to your target.
In Xcode select your Project, then select your target, click on "Build Phases" and expand "Link Binary with Libraries". Then click on the "+" and search for AVFoundation, add it and you should be good to go.
Scratch my previous answer, I found a more likely solution.
I believe that when you added the framework to your project you copied it into your project instead of simply linking it to the project. You should remove the framework from the project, by deleting ONLY if necessary. Then add the framework again.
If you are adding it by dragging and dropping from Finder, be sure to uncheck the "copy" checkbox when coping to Xcode.
I am trying to build an App using the GData static library libGDataTouchStaticLib.a
I have made all the appropriate linkings in my project settings and have copied GDataXMLNode.h and GDataXMLNode.m to my project.
I am receiving the error below. Can someone help me understand what this is?
ld: duplicate symbol _kGDataXMLXPathDefaultNamespacePrefix in
/Users/myUser/Library/Developer/Xcode/DerivedData/GData-edmqtrniowvhfjgfgngtlfxttvri/Build/Products/Debug-iphoneos/libGDataTouchStaticLib.a(GDataXMLNode.o) and
/Users/myUser/Library/Developer/Xcode/DerivedData/MyApp-grzimbvctfmwhmdluxbuxmskcvzy/Build/Intermediates/MyApp.build/Debug-iphoneos/MyApp.build/Objects-normal/armv7/GDataXMLNode.o for architecture armv7
Command /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/clang failed with exit code 1
You shouldn't have to copy in GDataXMLNode.h and GDataXMLNode.m to your project. I believe the reason you are getting the duplicate symbol error is because the libGDataTouchStaticLib.a library already contains the compiled GDataXMLNode.m class.
I am currently using the GData library in a project I am working on, and got it set up by using these instructions: http://hoishing.wordpress.com/2011/08/23/gdata-objective-c-client-setup-in-xcode-4/, so this answer assumes that you have the same setup. However I have used a slightly different way of importing the headers that was suggested by one of the comments on the above blog.
In your Xcode project remove the GDataXMLNode.h and GDataXMLNode.m files, and make sure that the GData.xcodeproj project is linked into your project the same way as in the above blog, but do not drag the headers directory to your source tree. Add these arguments to the Debug and Release Header Search Paths of your current target instead:
/usr/include/libxml2
${BUILT_PRODUCTS_DIR}/Headers
You can find this under the Build Settings tab of your target. The second argument will import all the GData headers into your project if you have set up the GData.xcodeproj file correctly. Once you have done this you should be able to import the various GData classes including GDataXMLNode.h class wherever you need it by typing this at the top of the appropriate class:
#import "GDataXMLNode.h"
Much credit goes to Kelvin's blog for his great tutorial. Hope that helps!
I have included the class KMLParser.m of Apple's KML Viewer in my project.The problem that I have is that when I try to build the project i get two errors like these:
_CLLocationCoordinate2DMake,referenced from:
_strToCoords in KMLParser.o
_CLLocationCoordinate2DisValid, referenced from:
_strToCoords in KMLParser.m
I don't have any idea why this error occurs, because i have left the files KMLParser.m and KMLParser.h intact, I haven't made any change to them.When I build KML Viewer, everything is fine. Please,illuminate me.
I am also working on implementing KMLViewer in my project. Turns out that accidentally linking with the incorrect target will cause the same errors.
For XCode 4.x, under the list of Targets, it could be that there are multiple targets, such as MyApp and MyAppTests. Select the correct target (e.g., MyApp), then add the framework(s).
You need to add the Core Location framework to your project (an #import alone is not enough).
For Xcode 3.x, right-click on the project file and go to Add - Existing Frameworks.
For Xcode 4.x, see How to "add existing frameworks" in Xcode 4?.