Trouble using QuickTime method - metadata

I'm trying to use QTCopyMovieMetaData defined in Quicktime/Movies.h. I've linked both QTKit and QuickTime frameworks to my target and imported everything necessary into my header and implementation files:
#import <Cocoa/Cocoa.h>
#import <Foundation/Foundation.h>
#import <QTKit/QTKit.h>
#import <QuickTime/QuickTime.h>
#import "Quicktime/Movies.h"
However, I'm getting compiler errors for not recognizting QTCopyMovieMetaData or QTMetaDataRef (also declared in Movies.h).
The example code in QTMediaEditor uses QTCopyMovieMetaData and compiles sucessfully on my machine for a 32 bit target, but not a 64 bit target. My app won't compile for 32 bit. Comparing my app's build settings with QTMediaEditors build settings, I don't see what would cause that difference.
Any advice on what might be blocking the QuickTime framework?

The QTCopyMovieMetaData function is not available in 64-bit. Note that the entire contents of Movies.h are subject to an #if !__LP64__ condition; everything in that file is only declared on 32-bit architectures.
My app won't compile for 32 bit.
If you mean you're dropping 32-bit support, good; QuickTime already has.
You need to use the Metadata framework to examine the file. Note that this will only work if the file is on a volume with a Spotlight index, and only if the file has been indexed. There is no replacement in QTKit (not as of Snow Leopard, anyway) for the QuickTime framework's QTMetaData API.

Related

Zebra Printer SDK swift

I am currently trying to write an App, that connects to a Zebra printer using Swift. I followed these instructions to link the SDK to the project and this page for information on what to add to the bridging header.
This is where it fails. As soon as I add a single line to the bridging header, for example #import "SGD.h" it does not compile, with the error 'SGD.h' file not found
I know this question was already self answered by the writer, but... It doesn't answer the question of how to correctly add the Zebra sdk to a Swift project (which is nowhere to be found on Zebra's site or in the documentation).
Add the framework ".a" file (libZSDK_API.a) to your project.
Add the entire "include" folder provided by Zebra (make sure to add as group)
Add a bridging header
All of that was pretty standard, now here is the tricky part. Add the following imports to the bridging header in this exact same order:
#import "MFiBtPrinterConnection.h"
#import "ZebraPrinterConnection.h"
#import "ZebraPrinter.h"
#import "ZebraPrinterFactory.h"
#import "TcpPrinterConnection.h"
#import "SGD.h"
I figured it out: This was not very clear from the instructions, but I configured those settings in The Project settings, not the Target settings. I also had to disable Bitcode.

Import Objective-c library into Swift App

I'd like to use a statically compiled objective-c library (+ headers) in my Swift app. I've already defined my bridging header for the project but Xcode still can't find the header.
Here's what my project's hiearchy looks
PROJECT_DIRECTORY/
---SwiftApp
------SwiftApp-Bridging-Header.h
------SwiftApp.xcodeproj
------Other Swift files live here
---Objective-C_Dependencies
------SharedLibrary/
---------Public/SharedLibraryInclude.h
---------SharedLibrary.a
The contents of SwiftApp-Bridging-Header.h:
#import "SharedLibrary/SharedLibraryInclude.h"
Despite the SwiftApp's Build Setting's header search paths to include $(SRCROOT)/../Objective-C_Dependencies/SharedLibrary/Public and Swift Compiler - Search Paths's Import Path to also have the same value as above, xcode tells me that
SharedLibrary/SharedLibraryInclude.h can't be found.
What else should I configure for Swift to recognize my external includes?

xcode create constant/variable as a build setting?

I have a URL used multiple times in my code and would like to centralize it into something like a build setting constant/variable. How would I go about accessing a build setting from my code? And is this the right thing to do?
Thank you.
Constants.h
static NSString * const myStackURL = #"http://stackoverflow.com/users";
or
#define myStackURL #"http://stackoverflow.com/users"
What you want to do, essentially, is import a header that defines a constant into every one of your other files. The easiest way to do this is to stick it in (application name)-Prefix.pch in the Supporting Files group in the project navigator. Anything defined in this precompiled header can be used by any other file. From Programming iOS 5 by Matt Neuburg:
The precompiled header is a device for making compilation go faster.
It’s a header file; it is compiled once (or at least, very
infrequently) and the results are cached (off in /var/folders/) and
are implicitly imported by all your code files. So the precompiled
header should consist primarily of #import directives for headers that
never change (such as the built-in Cocoa headers); it is also a
reasonable place to put #defines that will never change and that are
to be shared by all your code.

In Objective-C, importing same headers in every class make compile time longer?

I'm a beginner of Objective-C/iOS programing.
I want make a one header file which includes all class headers I use in my project.
And import the header in every class header file.
Like this question:
Including multiple classes in the same header file
But does this approach increase compile time?
Or are there any other disadvantage?
Please tell me the good ways to import headers.
In general, newly-generated iOS projects come with this functionality, which is called a precompiled header or prefix header, and is a file that has the extension .pch.
You can throw all the headers you want in there and Xcode will pre-compile it before it builds anything else, and use it to compile the other compilation units in your project (e.g. .m files).
Using a precompiled header may or may not increase compile time; in general, it reduces compile time, as long as you have a lot of common headers and/or a lot of source files.
However, it's not necessarily good practice to treat the pre-compiled header like a big dumping ground, as your compilation units can form implicit dependencies on all sorts of stuff when you may want to enforce loose coupling between components.
The issue with all the classes in one header is that every time you change a class header then all the files including it even indirectly will need to be recompiled, whilst if you only import the needed class and also use #class when you can then only the files that directly use the class need to be recompiled. Thus in the first case there will be many more compilations than in the latter. This is the way I would recommend to start.
However when your code becomes more stable and classes do NOT change then putting them all in one header can improve the compile time as the precompiled header will contain the same information for each file. What I would do is when the code is not changing so much is put the mature classes into a Framework and the Framework header will include all these classes.
You can import that header file in your projects prefix_pch file.then You can use it in Your classes .
If you want headers imported globally you should do so in the YourProject-Prefix.pch file. It should look something like this..
#import <Availability.h>
#ifndef __IPHONE_4_0
#warning "This project uses features only available in iOS SDK 4.0 and later."
#endif
#ifdef __OBJC__
#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
#import "YourGlobalHeader.h"
#endif
Now, All of your classes have YourGlobalHeader.h automagically imported.
Putting all the headers in one file may improve build performance in certain cases, but you probably won't notice the difference.
It is better to keep your class headers in different files for purposes of organization. Also, if you are only including the headers that you need in your source files then your build time will be reduced, although again not noticeably if you are using a decent build machine.

`#import "FBConnect.h"` vs. '#import "FBConnect/FBConnect.h" '

It took me some time to get XCode to locate the Facebook sdk.
I added ‘....../facebook-ios-sdk/src ‘ into ‘Header Search Paths’ in ‘Project Settings’ (the ‘Header Search Paths’ in the ‘Target Info’ does not show the directory however) , and use:
#import "FBConnect.h" ,
instead of #import "FBConnect/FBConnect.h", then the XCode can locate the facebook sdk.
As the 'FBConnect.h' is directly under the /src, where is the 'FBConnect'? What does "FBConnect/FBConnect.h" mean? Do you guys use #import "FBConnect/FBConnect.h" without manually adding a 'FBConnect' directory or Group in XCode?
I also use #import "FBConnect/FBConnect.h" in my projects, but you don't need to add the Facebook iOS SDK to your search paths in Xcode. Xcode automatically adds paths for compilable files in your source tree to gcc's list of include paths. Groups in Xcode are only for your peace of mind and project organization -- they have absolutely no effect on your project's build settings. The use of FBConnect here refers to a subdirectory on the filesystem, not the actual group name in your project.
Keep in mind that there are actually two Facebook SDKs available for the iPhone: facebook-ios-sdk and facebook-iphone-sdk. I'm not 100% sure as to why, but I think that the facebook-iphone-sdk is being deprecated in favor of the new one. Since Facebook (for some odd reason) chose to put their header files in an additional subdirectory also named "FBConnect" underneath the main source directory in the facebook-iphone-sdk project, you need to add the additional FBConnect when importing this file. Also, you'll see a lot of examples referencing the old project code which uses this importing style as well.