Accessing Scanners in Mac OS X - macos

I'm primarily a windows developer but I need to port an app to the mac platform.
The app needs access to any scanners plugged into the computer. On windows, I've made use of the WIA library. I was wondering if the mac platform has an equivalent and also if it has bindings for the new Swift language?
Any help would be appreciated. Thanks.

You can access scanners and other devices using ImageKit + ImageCaptureCore. Some of Apple's documentation is very sparse, so you shouldn't be afraid to learn things from the header files (e.g. ICScannerDevice.h). It might help to look at some of the code I wrote for this application, particularly this file.
There is no such thing as "bindings" for Swift, since Swift currently uses the Objective-C runtime and interacts directly with Objective-C. This guide will help.

Related

Adobe AIR on Mac - Access Bluetooth data

I am exploring some ideas and trying to make three different applications talking each other via bluetooth.
Two of them would run on Android phones, while the third would run on a MacMini. I can use Bluetooth on the Android phones almost without problems by using native extensions, but I am a bit confused about how to access it on the Mac Mini.
Any research about native extension leads me to mobile related links.
Any idea on how I could send and receive data to/from bluetooth on osX?
Is native extensions the way to go? And in case that was the way, do you know if there is any Native Extension available that I can use? Writing one on my own can be a bit overwhelming...
Yes, you'll need a native extension to access Bluetooth on the Mac.
The process should be more or less the same as on mobile, except of course the Mac extension will need to be built to target OS X instead of Android. A quick Google search turned up this article which might help get you headed in the right direction:
How to Create an Adobe AIR Native Extension for Mac OSX
Library FPBluetooth.ane supported platforms iOS+OSX.

How can I use pkcs11 in mac os(10.9) native programs?

First, I can't communicate in english very well.
I will develop PKI.
I can control token in firefox, thunderbird but can't control mac native program(ex. safari, mail).
How can I control the token in os x 10.9(mavericks) native program (ex. safari, mail) ?
I heard use tokend but, also heard now tokend is deprecated.
Is that right?
and, I saw macosforge.org. but I didn't know.
frankly speaking, I'm a Windows developer. so, I don't know much about mac development environments.
Hope you can help.
TokenD is technically deprecated (as is the entire CDSA subsystem it sits upon) since at OSX 10.7.
It sounds like you want a PKCS#11 module to work with native components, you may want to take a look at Gemalto's PKCS#11 -> TokenD bridge: https://smartcardservices.macosforge.org/trac/browser/trunk/Tokend/PKCS11
Note that TokenD -> PKCS#11 usage is tricky in that updates to the contents of the PKCS#11 device may or may not show up until you remove/insert the token.
If you are unfamiliar with Mac OSX build environments, you will likely want to hire/contract out with someone familiar with legacy Mac OSX security (I say legacy since the "new" environment does not yet interact with external security devices).

How do I code applications on a Mac so that they use the native UI elements?

I'm starting to program. Already did some things with Java: a calculator, one document management system powered with a database and some other home projects. But I don't like the visual look. I love however how mi Mac's Apps look. And I want to create Apps for mac. Already buy one but when I open netbeans to program it looks like the Apps doesn't feel like mac.
Is there any specific java code to make the controls looks like how the other mac apps look? My dad mention something about Object C but I don't understand. Can someone please explain me.
AFAIK You'll never get the look and feel of Aqua (Mac's UI Kit) by using Java. Why? Because to make Java platform independent some things needs to get ripped off. And native controls are one of them.
I think you're taking about Objective C which is the native development language for building Mac Apps. I'll recommend you the book "Learn Objective-C on the Mac" is pretty useful.
P.S. I'll encourage you to start with iOS (iPhone and iPad apps). Why? Well, I think is easier to begin with. Things like fixed resolution and so on make your development efforts small while beginning with. (Just my 2 cents)
If you want to code in Objective-C, you'll first need to trek over to the App Store and download Xcode. This will install C/C++/Objective-C compilers on your Mac and then you can start getting your hands dirty.
Depending on what you are trying to accomplish, you can just google/read/learn and build your own frameworks from the ground up or look at something like Cocoa to get started as well.
http://developer.apple.com/technologies/mac/cocoa.html
Cocoa Frameworks
The Cocoa frameworks consist of libraries, APIs, and runtimes that form the development layer for all of Mac OS X. By developing with Cocoa, you will be creating applications the same way Mac OS X itself is created. Your application will automatically inherit the great behaviors and appearances of Mac OS X, with full access to the underlying power of the UNIX operating system. Using Cocoa with the Xcode IDE is simply the best way to create native Mac applications.
Good luck!
Apple has deprecated a lot of the Java support in OS X. It's possible to have a Java application integrated, but there are some annoying bits missing. See one of my questions demonstrating some issues with Java applications in the Dock. You would be better off using Objective-C instead, since Apple has lots of documentation and tutorials available.
You're thinking of Objective C. You can also do applications for Mac using C/C++ but as of late the "popular" language for Mac development is Objective-C. There are tons of tutorials and plenty of documentation to walk you through writing apps for both Mac and iOS.

Switching from iOS Development to Mac Development

I want to update my developing knowledge from iOS to Mac for distributing my apps to Mac App Store.
What are the differences? What are the limitations?
For example, if I want to port my iPhone app that syncs contacts with social network the various NSRequest or ABAddressBook are the same? It changes only views and corresponding view controllers?
Does exists some sort of "adapters" from iOS to Mac to easily convert iOS apps to Mac?
In general, what challenges Mac apps arise respect to iOS apps?
Thanks
If you've gathered some experience you will get along with mac development in no time. Mac and iOS have many things in common, however there are some gotchas, not all of which are visible at first glance.
The most obvious difference may be the use of viewcontrollers - cocoa for mac knows viewcontrollers, however they play a different (and less important) role.
I think the best approach for you would be to take a quick look at the Cocoa Application Tutorial and the Cocoa Fundamentals Guide. Most of it will appear familiar to you. Other than that I'd suggest to not port that project over, but use it as a opportunity to learn mac dev and recreate it from scratch (if it is not too complex). Of course you can copy paste many of the logic stuff, no need to reinvent the wheel.
By the way, I started out developing for iOS too and I found it to be very easy to get used to cocoa mac.
As to your question regarding NSURLRequest (I think that's what you meant, theres no NSRequest in either platform), they are almost the same. Just look it up in the reference library. I found it very helpful to have the iOS and mac os reference library available at the same in my browser, so I could look up differences quickly.

How hard is it to get a Cocoa application to run on Windows?

In the wikipedia article on Cocoa it says:
There are also open source implementations of major parts of the Cocoa framework that allows cross-platform (including Microsoft Windows) Cocoa application development, such as GNUstep, Cappuccino, and Cocotron.
Yet when I looked into whether Mac application Tweetie was available for windows the developer had ruled it out:
Windows doesn't have Cocoa, the programming environment that Tweetie is made in, as such, it seems like a poor possibility.
I'd like to have an answer to point the Tweetie developers (and as a resource for other cocoa developers) which would tell them:
Which implementation is the most suitable for getting a cocoa app running on windows?
How much work is it likely to take to get the app running under windows?
How easy/hard is it to maintain a common code base for Mac and Windows?
(any other considerations I've missed?)
Of course if it would be too much work I'd like to know that too before suggesting it and potentially sending someone else on a fruitless search.
Don't forget:
“Major parts of the Cocoa frameworks” is not the same as “the entirety of the Cocoa frameworks”. Tweetie could be using something that's missing.
Tweetie could be (very probably is) using APIs from the non-Cocoa frameworks, such as Core Foundation, Core Services, Core Graphics, and Core Animation. A port of the Cocoa frameworks alone won't include any of these APIs, and even a more complete Mac-API-emulation framework will not include all of them.
These frameworks are eternally chasing Apple. Even if they catch up, they'll be instantly behind again as of the next Mac OS X release. Mac developers already put off using new APIs in new Mac OS X releases while they wait for users to upgrade to those new releases; now you're asking atebits to also wait for the other-framework developer to catch up to Apple again.
Any second implementation of an existing API will have bugs that the first implementation doesn't, and vice versa. These differences will cause development and support problems.
You're asking atebits to add a third platform to an application that already exists on two. Supporting one platform is a lot of work. Supporting two platforms is a hell of a lot of work. Supporting three? Now you're getting into big-company territory.
So, even with these Cocoa-like frameworks, the answer is: Hard.
Among GNUstep, Cappuccino and Cocotron, Cocotron is only possible choice to port a Mac application to windows.
Cappuccino is for web and GNUstep only runs on top of cygwin or mingw, which means the GUI looks nothing like native windows apps.
It is theoretically possible to build cocoa windows apps using Cocotron. However, the reality is that it is still very hard to use, and it is still quite limited in the Cocoa API.
Therefore, two possible solutions:
Try hard to remove the codes that are not supported by Cocotron in the original code base and do the cross compilation. Maintaining common code base will be painful.
Start a new GUI at all, no common code base. two choices here
Start a cross platform project with cross application framework such as Qt, or Java.
Start a windows only project. There are a lot of choices here, .Net WinForm application, MFC, etc.
There are Windows compilers for Objective-C (the programming language used to write cocoa apps). However, Cocoa includes the frameworks for presenting the GUI. These visual frameworks are specific to Mac OS X because they use OS X only windows and other controls. So someone would need to re-implement the controls in Cocoa to use Windows controls.
Also, I am fairly certain that Tweetie uses Mac OS X only technologies like Core Animation. This does not exist on Windows, so the nice animation effects present in the apps would have to be implemented in a completely different way.

Resources