I've been trying to develop a status bar app for Yosemite, which is my first OS X app, but when I searched for the document, the NSStatusItem documentation says that almost all of the properties and methods there (e.g. .title, .highlightMode, and .image) are deprecated in OS X 10.10.
So I wonder how I can create a status bar app for Yosemite. I found those documentations from Dash, but it's weird that Apple's documentation doesn't make it deprecated yet. But I know they are usually slow to update the documentation, though I wonder then how and where Dash got those seemingly updated information...
So which is the correct? And if it is deprecated, where can I find the Yosemite-style status bar development resources?
I use Xcode 6.1 Beta and Swift.
In 10.10, NSStatusItem has a new button property which returns an instance of a new class, NSStatusBarButton inheriting from NSButton. This is what should be used instead of setting a custom view on the status item. The deprecated methods of NSStatusItem just forward on to the corresponding method of the button.
See the header files (NSStatusItem.h and NSStatusBarButton.h) for the most current and accurate documentation. The prerelease class references seem to be incomplete. There's some brief, indirect mentions of these changes in the 10.10 AppKit release notes.
Related
I've designed an app that includes support for the touch bar. The touch bar is created in Interface Builder. All code uses Swift's #available checks to make sure that no touch bar code gets executed on macOS prior to 10.12.
The XIB (and app) is set to deploy to 10.10, but when I run my app I still get errors like:
-[NSKeyedUnarchiver decodeObjectForKey:]: cannot decode object of class (NSTouchBar)
How can I make sure that decoding the XIB skips the touch bar on macOS prior to 10.12?
You have two choices.
Create the UI programmatically.
Register dummy class pairs for the class name. I'm not sure how to achieve this in Swift, but there is an Obj-C solution here: How to use NSVisualEffectView backwards-compatible with OSX < 10.10?. That answer also provides some extra caution regarding subsequent access of the component.
I have an android background, but am just learning how to build iPhone apps using swift. I am using the book Beginning iPhone Development with Swift 2: Exploring the iOS SDK.
Problem is that it refers to Buttons and such being in the Object Library and I don't have anything in my object library. I have clicked on the View as instructed.
I have a newly installed MacBook and am running Xcode 8.1, which is newer than the book's directions. It refers to iOS UIkit, but I don't know how to install this.
I did Single View Application under iPhone to get where I am. Can anyone point me to what I need to do? I am brand new to the Apple world entirely.
Aha! In the main window, I clicked on the storyboard and that allowed the Object Library to contain the view items, including buttons.
So, click on the storyboard in the main window, then click on the view in the IB.
If I subclass SCNParticleSystem and add a property to the custom subclass, and assign a value to the property. SceneKit will crash on Mac. But it works on iOS and tvOS!
The crash always occurs when the particle systems emitter shape is being assigned a SCNNode geometry!
Its that: EXC_BAD_ACCESS (code=1...)
See the screenshots & test my simple example project.
I don’t understand why this is crashing, is there a workaround? How can I add custom properties to a SCNParticleSystem otherwise?
Xcode 7.2
Xcode 7.3 beta (7D111g)
Mac OS X 10.11.3 (15D21)
Example Project
I have not been able to get my NSPopover to detach to a window in my own projects, so to simplify I tried the Apple sample.
I downloaded a fresh copy of the Apple sample project: http://developer.apple.com/library/mac/samplecode/Popover/Introduction/Intro.html
It behaves the same, which is to say I can't drag the window to detach it either.
The project seems to provide all the correct windows and controllers and implements the detachableWindowForPopover: delegate method. However the method is never called.
Does anyone know the secret to detachable NSPopovers?
Found the answer while typing the question…
Mac OS X 10.10 Yosemite has a new delegate method:
(BOOL)popoverShouldDetach:(NSPopover *)popover
The default behavior on Yosemite is NO (should not detach). So delegates must implement this method in order for windows to be detachable. The sample project does not implement this method, so when compiled on Yosemite it will not detach (and also produces several deprecation warnings -- maybe I should have taken that hint that it needs an update).
Adding:
- (BOOL)popoverShouldDetach:(NSPopover *)popover {
return YES;
}
To MyWindowController.m fixes the problem.
We're developing an OSX app that have to be supported by OSX 10.7 to 10.9. We're currently using QTKit and QTMovieView to show videos, but when trying to upload a new version recently we got this error message:
Deprecated API usage. Apple no longer accepts submissions of apps that use QuickTime APIs.
We have also tested to set the Base SDK to 10.8, but same result there.
And changing to AVKit and AVPlayerView does not work for version prior to 10.9.
So is there a way to use AVKit for versions prior to 10.9 or some way to publish an app with QTKit?
You can't use AVKit on OS X versions prior to Mavericks.
But AVKit is a very small framework that only consists of a player view that has some advanced features out of the box (e.g. chapter navigation, selection & trimming, ... - similar to QTMovieView).
If your app doesn't require those features, you can easily implement a view with simple playback functionality with AVFoundation-only classes (AVFoundation was introduced with OS X 10.7).
Instead of AVPlayerView, you can use a combination of AVPlayer & AVPlayerLayer.
There is some Apple sample code that shows how to build a DIY player view here:
https://developer.apple.com/library/mac/samplecode/AVSimplePlayerOSX/Introduction/Intro.html#//apple_ref/doc/uid/DTS40011060
This custom player view supports:
Play/Pause
Rewind
Playback progress
Fast forward
Volume control