Hi I'm trying to develop an iOS app with Vuforia SDK, but where I can find a way to start to integrate this SDK? I looked on the Vuforia web site, but there aren't any interesting documentation about how to integrate the SDK in my app? There's a tutorial that I can follow to understand how it works? On the official web site there are tutorial only for Unity, but I want to develop my app in Objective-C.
I hope you can help me
I realize this is a very old thread, but maybe you'll get an email ping, or perhaps a Google-er will find this useful.
So let me guess, you want to use one of Vuforia's sample apps, but in your own project, right? And you imported everything and made it look just like their project, but it won't even come close to compiling, right? And that sample app is almost certainly the SampleVideo example? If so, read on…
1) Xcode will get the import wrong if you simply include the library in your project. What you want to do is…
a) make a copy of the build folder inside the Vuforia API and put it somewhere else
b) rename that to something more useful, like "Vuforia"
c) use Add… to put that new folder into your own project (you can refer to it, I copy)
d) go to Build Settings, type "search" into the search bar (seems redundant, I know)
e) you should now see two very important lines, Header Search Paths and Library Search Paths. if you don't, you need to find them
f) double-click on header search paths so the pop-up gizmo appears. press the + button. Now go into the finder, find the Vuforia/include folder (which might be inside your own project if you copied it, like I do) and drag that folder into the pop-up gizmo
g) repeat for the Library, but drag the lib folder in instead.
Ok, done! No, sorry, I lied…
2) import the code from their samples that you want. It might be in several different folders
3) go to Build Phases and while that screen is up, do a build.
4) lots of errors will appear about ARC. use the search bar to find those files and add a "-fno-objc-arc" flag to each one. Repeat as required.
5) do another build, note that you're missing libraries which Vuforia couldn't be bothered to tell you about (sigh). So in Build Phases, open Link Binary With and add…
a) AVFoundation
b) AudioToolbox
c) QuartzCore
d) CoreMedia
e) CoreVideo
f) MediaPlayer
g) OpenGLES
h) CoreMotion
i) SystemConfiguration
6) do another build. Now you'll get a different error, but it won't be obvious it's different until you click on it. Look for "missing required architecture". If you see this, change your target to your phone, because Vuforia doesn't work in the simulator. Which makes sense because it doesn't have a camera… or not, because my apps do a lot more than just Vuforia but this limitation means I can't test any of it on the sim. (sigh)
7) so you switch the target to your shiny new iPhone 5S, build and… get errors about missing architectures. So now you see it's missing arm64… so you have to go to your Build Settings, remove Standard Architectures and add in armv7 and armv7s.
8) now you can look at the warnings and go about fixing the errors in their code, and the long-ago deprecated calls. naturalSize is easy:
AVURLAsset getting video size
One last warning. Once you get everything compiling and such, you'll try to import one of the Vuforia headers into your own code and then you'll get another error about "namespace". Make sure to change any file that imports from their code to a .mm as well.
Are you having fun yet?
I hope this link will be helpful for you, https://developer.vuforia.com/resources/dev-guide/step-2-installing-vuforia-sdk-ios
https://developer.vuforia.com/resources/dev-guide/getting-started-ios-native-sdk
Place your unarchived Vuforia sdk in your development
directory/folder.
Add libQCAR.a framework in your project.
Set libQCAR.a framework path in XCode build setting "Library Search Paths"
Set Vuforia header classes folder path from unarchived Vuforia sdk
in your development directory/folder in "Header Search Paths"
Today Vuforia 4.0 is simple. There is no need to "Add libQCAR.a framework in your project." and so on.
Take care of the path of folder in this image!!!
Step by step:
https://developer.vuforia.com/library/articles/Solution/Installing-the-Vuforia-iOS-SDK
https://developer.vuforia.com/library/articles/Solution/Installing-the-Vuforia-iOS-Samples
https://developer.vuforia.com/library/articles/Solution/Compiling-and-Running-a-Vuforia-iOS-Sample-App
For Vuforia 4.0 (currently in beta), Maury's answer didn't quite do it for me. I kept getting errors about "missing required architecture armv7s", even though I had set Architectures to armv7 / armv7s.
I then also to also change:
C++ Language Dialect in Build Settings to: C++ 11
C++ Standard Library in Build Settings to: libc++
After making the above changes my project built successfully.
Related
I'm updating an old iOS app using Xcode 7.3. The deployment target is 7.0 and the previous version was built for iOS 8. There are about a dozen frameworks included (e.g., Security.framework) and also sqlite3.0.dylib and libSystem.B.dylib which appear in red in the Project Navigator because they can't be found. Indeed, "Open in Finder" gives no result.
However, despite this, the app compiles, and runs without errors in the SIM and on a device, even after Clean. Somehow the SQLite library is being linked, but what magic is at work here?
I think I should just add libsqlite3.0.tbd but I'd like to understand what's going on in case I break something under iOS 7 and 8 (why no link errors?). Need I about libSystem.B.dylib -- is it needed?
sqlite3.0.dylib and libSystem.B.dylib are system libs. Project navigator and dylib search paths are different things. Project navigator as the name says is used to navigate the project so it is more or less a tool for the developer to easy navigate a project. Usually it also shows your linked libs, but they keep a path to those frameworks and the path is no longer valid in your case. On the other hand there is Framework Search Paths which you can find in Build settings. There are the paths where the linker searches for the expected libraries. But since your libs are from the system you don't even need to specify a Framework search path because paths to system libs are set by default, so for system libs you just have to specify that you want to link them to your project. So you can safely remove those red libs from your project navigator. And as long as it is specified in your settings that you want to use those libs in Link Binary With Libraries the whole thing should work.
I'm new to OSX/iOS development and I'm developing a library project (Cocoa Touch Framework) for iOS. While working on the library I would like to test changes to the code, but because it's a library, I can't run it straight away from XCode and view it's output. What I'm used to do in other platforms, (Windows for example) is to create a another project under the same solution (Visual Studio), add the library to this project and write my test code there. Unfortunately I didn't find a way to do something similar in XCode, my workflow now consists of quitting/opening two different projects, copying frameworks around and re-adding framework dependencies.
Surely there must be a better way to do this...
There are lots of post already in the SO .
But keeping it simple just follow these steps :
1.) Drag and drop Xcode project to your Xcode project 2.) go to build phase and then select your project (which u have imported ) to target. 3.) Search path - > user header search path (select your library) and also enter other linker flag.
Simple !
Is't exactly the same in Xcode :)
If you have a project (without a test build accompanying it) is:
1) See, no test Target :(
2) Click on the target that you want a test environment for (in my case, locates) so it's highlighted.
3) Click on the "edit" menu, then pop down to "Conver to" then "XCTest"
(yet another one of Apple's ambiguous places to hide things!)
Follow the wizard and that'll create you an XCTest build target that can be run on demand and through CI.
Have fun!
I know of familiar tutorials on this, but introduction of framework XCode 6 template has changed the game.
I already watched WWDC 2014 video about building modern frameworks but it talks more about building extensions, framework & app all inside single project. It does not specify if the framework I make with it is truly reusable across any project.
I am building framework the XCode 6 way (File->New Project->Framework and Library->Cocoa Touch Framework), but when I import it inside my test app project (separate from framework project) - I keep getting various errors.
Example: Include of non-modular header inside framework, and so on.
I know this is not what it says, and there are quite some missing steps in whatever I am doing. The older tricks may have worked for everyone, but I simply don't find which way to follow after XCode 6.
For example, there is some folder structure that a framework needs, but XCode 6 doesn't comply to it while building it. Is it right? If not, how can I change the way the XCode builds framework folder hierarchy?
Do I go back to old school or am I screwing some tiny thing in XCode 6 that I am unable to create a reusable framework?
I am not sure if you are trying to build a framework with Objective-C or Swift as your question doesn't state it. I've encountered errors you are mentioning with Swift so I'll give you my method to build Swift frameworks.
I found the process for Objective-C to be very straightforward and well documented, so I'll skip this.
As for Swift, there are a few things to consider. First, Swift static libraries are not supported, so you must exclusively use a framework (aka dynamic library) when linking an app to a library.
Here are the steps:
Create the Framework using New > Project under IOS > Framework & Library, select Cocoa Touch Framework
To avoid the "ld: warning: directory not found for option..." goto Library Search Paths in Build Settings for your target and delete the paths.
You can't mix Objective-C with Swift so don't even consider adding the Swift-Header bridge file in your code.
There are some cases in swift where you need to import code from unexposed Frameworks. I've successfully used the module-map inside the framework to deal with these case.
I also select CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES = YES in the Build Settings to solve 'include of non-modular header inside framework module'. That seems to work
I make sure that the header file that gets generated is marked as Public (not Project). Click on the file and you'll see the selection in the inspector under 'Target Membership'
You may run into some bizarre error messages when building. Xcode has a tendency to report linker errors when your code can't compile correctly resulting in missing files the linker needs to output its binaries. Sometimes XCode won't show the errors in the files you are compiling and you need to go manually on the build output and go back to the files. Some other time, you'll get a problem where you need to delete the cache. Those issues I call XCode blues and deal with it constantly. I found this type of problems happens more often when building libraries. The rest should work as expected.
In Xcode 5, I create a game demo using Xcode's 'Game Template', it links frameworks like this:
It use SpriteKit's code, but if I remove the SpriteKit.framework, it works too. I also use CoreMotion and find it not work without link CoreMotion Framework.
Then I create a game demo using Xcode 6, it doesn't link any framework now:
But it also works.
So there is no need to link frameworks?
I mainly using Xcode 5. Without linking how can I set it to 'Optional' to not crash on iOS6 ?
Okay, so this is basically a recollection from memory, correct me if I'm wrong.
Xcode can determine at compile time which (Apple) frameworks are referenced and links with them. It can also determine which other targets the main app target references.
However there's the possibility that this isn't quite true and since you've already built the project once with all the frameworks linked, the temporary build files make it so that the build with an empty Link Binaries list still works. To verify that, run a Product -> Clean in Xcode, then build & run again.
I'm not sure about using an optional framework. Either those frameworks are implicitly optional, or the whole point of adding them to the Link Binaries list is to be able to set them as optional.
A quick test with iOS 6.0 or earlier Simulator should help you find out which way it is.
I'm having trouble linking to a static library in Xcode 5. I did read the chapter on building and using a static library in the Pro iOS 5 Tools. What it told me to do after creating your static library, was to link against the framework in the Build Phases tab. That part is pretty straight forward. Then it says in the Build Settings, under "Header Search Paths", to add:
$(BUILT_PRODUCTS_DIR)
Then in order to use my static library, I just import it like so:
#import "ConversionCalculator/ConversionCalculator.h"
So this used to work up until yesterday. I tried adding a new static library to my project which didn't seem to work. So I cleaned my project, and tried rebuilding again, but now Xcode complains about #import "ConversionCalculator/ConversionCalculator.h". It says
Lexical or Preprocessor issue. 'ConversionCalculator/ConversionCalculator.h' file could not be found.
I was wondering if anyone has any tips on debugging this. I've looked through different tutorials like this:
http://blog.stevex.net/2012/04/static-libraries-in-xcode/
http://cocoamanifest.net/articles/2011/06/library-management-with-xcode-workspaces.html
http://www.raywenderlich.com/41377/creating-a-status-library-in-ios-tutorial
But I can't seem to find the "golden way" to link to a static lib, or how to troubleshoot why Xcode cannot find my file. My file structure is setup on my machine like so:
Projects\
DistanceCalculator\DistanceCalculator.xcodeproj
ConversionCalculator\ConversionCalculator.xcodeproj
DistanceCalculator.workspace
Like I said, this all used to work too when I followed the tutorial in Pro iOS 5 Tools book. Now I don't know why my workspace cannot find ConversionCalculator when it has used it before. The part I find hard is different articles say different things about the header search path, and I'm not sure what the best way to populate that field is. Any thoughts? Thanks in advance!
Edit:
I'll add that I can build for the device without errors. But when I switch to the iPhone simulator, it gives me that error about not being able to find the file. I also see that I get this warning:
ConversionCalculator was rejected as an implicit dependency for 'libConversionCalculator.a' because its architectures 'i386' didn't contain all required architectures 'i386 x86_64'
Looking at that, I'm not sure what that means. If it means that my library is not being built for all architectures, I just tried creating a Target that builds for all architectures according to the wenderlich article in the above link. That seems to work as when I go to the dervieddata folder, I see for debug, release, and universal, I see the libConversionCalculator.a file. But then when I go back into the workspace and try to rebuild the project for the simulator, I get that could not find file error and the implicit warning.
Edit #2:
I just saw a warning flag on Xcode that says upgrade to recommended Build Settings. Now I get no errors. Not sure what happened... but I guess no errors is good.
I would follow the description available in Xcode's Help topic "Linking Against Your Library" in chapter Configuration Your Application in Introduction to Using Static Libraries in iOS
(you may search within Xcode Help, too).
Except that I would recommend to include your headers from libraries always using angle brackets:
#import <ConversionCalculator/ConversionCalculator.h>
Using double quotes may inadvertently search and find files with the same name in some sub-folder relative to the file where this import directive is written. Only after there was no file in any sub-folder the preprocessor starts searching with the specified header search paths.
Using angle brackets, the preprocessor immediately searches only at the specified header search paths.
So, since you actually want to find headers for the corresponding library, always use angle brackets.
Note: If you follow the recommendation to create a static library project, you don't need to explicitly set a header search path in the target that links agains the library: Xcode will already add a search path:
$(BUILT_PRODUCTS_DIR)/includes
Your library headers are located in
$(BUILT_PRODUCTS_DIR)/includes/<product-name>
which are placed there through the "Copy-Files" phase of the iOS static library target, whose "Destination" is set to "Products Directory" and whose "Subpath" is set to "includes/${PRODUCT_NAME}" per default.
You may change these default settings to other reasonable and sensible values. (if you do, consider the the consequences for Xcode's default search paths!)