How to import ZXing library into my os x swift app? - macos

Okay,
I'm new to xcode development and I'd like to use the
https://github.com/TheLevelUp/ZXingObjC
library in my swift os x app. I followed the instructions from here:
Importing 3rd party library ZXing into Xcode
First I downloaded it from github and added it to my project (right-click on my project->add Files to "myProject"). How described by clicking 'ZXingObjC.xcodeproj'. I added libZXingObjC-osx.a to "linked frameworks and libraries" and the font is red colored. Then I added the path to header and library search paths.
It compiles fine. But I cannot get access to the library. How can I use this library?
Thanks

Related

difference between dragging frameworks into framework folder and drag Link With Library?

In Xcode, what is the difference between:
Dragging framework (i.e. LoginWithAmazon.framework) into framework folder in the project tree (left pane in Xcode)
compared to
drag-and-drop the framework into the 'Link With Libraries' in Targets->[Project Name]?
The difference is that dragging a framework into your project won't necessarily link it to your binary (or target). Dragging a framework into your project (which you see in the Project Navigator) basically just puts it there until you actually link it with a target. With Apple's frameworks some of the linking is automatic, although for 3rd Party frameworks you'll almost always need to link them with your target.
Here's an example — you may have a project in which there are multiple targets, such as a iOS version and an OS X version. The iOS version might require a framework that OS X doesn't, although you can still have it's framework within your project. Since you wouldn't want to use that framework with the OS X target, you would only want to link it with the iOS target.
You can think of the frameworks dragged into your project almost as placeholders until you actually link them to a target.

How to create an .ipa file out of phonegap 3.5.0 project?

I'm very new to OS X and facing difficulties even in finding the menu options in xcode.
I tried all the resources available online. All I'm trying is to make an .ipa file out of the phonegap project which uses push notifications. I have tried phonegap build this way:
Created .p12 key and development provision file according to the instructions in the following link:
http://www.raywenderlich.com/32960/apple-push-notification-services-in-ios-6-tutorial-part-1
It's not working out. So, I started to use xcode to do it. But I don't find an option to edit scheme anywhere.
Kindly help me.
Change you device from iPhone/iPad in XCode to iOS Device then in the project build menu, select Archive. You will be prompted by Xcode to sign the app and if you don't have provisioning profile Xcode will assign you one.
Follow the archive menu to create an download the packaged IPA.

XCode Developer API - Object Library - Objects Disappearing

Fairly new to the Xcode Developer API and need a little help. When a project is first opened in Xcode, the Object Library displays the full list of UIKit objects available (and other linked frameworks I believe). However, when I switch files in the project navigator to/from any file (.m, .h, .xib, etc), the Object Library list changes; most of the objects are missing - such as NSButton, NSTableView etc. The standard objects are still visible - Label, Round Rect Button, Text Field, etc.
Closing and re-opening the same project appears to restore the Object Library list, but the same issue happens once a different file is opened.
Using Xcode Version 4.2.1, Build 4D502.
Help!
I think I see what you are describing. When I first open an iOS project the Object Library is showing objects that are valid for OS X but not iOS (like File Menu Item). When I switch to a xib file the Object Library gets updated to show only the objects that are valid for iOS. Ideally I suppose that wouldn't happen but since you can't do anything with the Object Library while a source file is in the editor no harm is done.
If you are developing application for iOS(iPad or iPhone) you will not get that library which contains pop button , check box ,NSButton, NSTableView etc,that library is available for OS X app development.
OS and OS X don't use the same graphics library. iOS and OS X development are similar, but not the same. For example - you don't have Cocoa Bindings on iOS.
I you want to check then make one project for iOS & then see your library contents,then create another project for OSX & see your library contents... :D

Why can't I drag the Facebook SDK into a new project?

On The Github page, it states:
In Xcode, open the Facebook SDK by selecting File->Open... and selecting src/facebook-ios-sdk.xcodeproj.
With your own application project open in Xcode, drag and drop the "FBConnect" folder from the Facebook SDK project into your application's project.
I know this worked for me earlier this year, using Xcode 3.x and iOS 4.x, but now I'm doing a new project in Xcode 4.2 and iOS 5 and it doesn't work anymore. I'm unable to drag the folder into my project. Any ideas? What should I do instead?
It's a better idea to just include all the necessary files directly into your project - so everything inside the src directory, excluding the .pch and .xcodeproj files.
Also, it sounds like you found a bug in Xcode 4.2, so it might be a good idea to submit a bug report to http://bugreport.apple.com :)
This is a bug in XCode 4.2. Just file a report with Apple. I have filed one too. More the number of reports, chances are they'll get a fix out earlier.
For now, I just use a mac with an older version of XCode, add any SDKs I need to add and then open the project again with the new version. That works :)

iOS 3.x support in Xcode 4

Is it possible to write apps that support iOS 3.x versions using Xcode 4? If so, how? And does Apple have any official recommendations on app backwards-compatibility?
To get your app successfully run in iOS 3.x device, follow these steps (Xcode 4.2):
Click on your project name, select your Target and under "Build Settings"
a) Set "iOS development target" (under "Deployment") to 3.0
b). Add "armv6" to list of "Architectures" (under "Architectures").
c) Set "Other Linker Flags" (under "Linking") to "-weak-lSystem".
In your Info.plist file remove value of "armv7" from "Required device capabilities" (UIRequiredDeviceCapabilities).
In your code:
a). Do not use userInterfaceIdiom. If you need to know, what device is it (iPhone or iPad), see How does one get UI_USER_INTERFACE_IDIOM() to work with iPhone OS SDK < 3.2.
b) Do not use window.rootViewController. Instead use [window addSubview: self.mainViewController.view]; to add your main controller's view to window.
Click on your project name, select your Target and under "Build Phases" / "Link Binary With Libraries" set "UIKit.framework" to "Optional". Also set to optional any extra framework, which is not available in iOS 3. For example, if you're using iAd or Twitter frameworks they should be set to optional. Check availability of extra framework in your code before use.
When run on real device, compile app against last version of SDK. To do so, select second item from "Scheme" drop down (otherwise you'll get compile error related to your optional SDKs):
Yes, you can develop apps that support previous iOS versions with the current iOS SDK.
For official recommendations, see Apple's SDK Compatibility Guide.
The version of Xcode that you use isn't related to the version of iOS that your app can support. To choose the version of iOS that your app supports, simply change the iOS deployment target in your project settings. Then just be sure not to use any APIs from versions later than that.
to be sure, you can use Xcode 4 for targeting iOS 3.x as a deployment target, but you will not be able to simulate your program on a iOS 3.x SDK simulator. So you are pretty on your own (i.e., if you use any iOS 4.x-only feature, you will not find out it until you test on a physical device).
You need an older version of Xcode to debug against an older simulated SDK.

Resources