Archive for the 'Mac' Category

OS X v10.8 Mountain Lion – New Frameworks

New Frameworks

The following frameworks have been added in OS X v10.8:

  • Accounts (Accounts.framework). The Accounts framework provides a single sign-on model for supported account types. Single sign-on improves the user experience because apps no longer need to prompt a user separately for login information related to an account. It also simplifies the development model for you by managing the account authorization process for your app. You can use this framework in conjunction with the Twitter framework to access a user’s Twitter account.
  • Event Kit (EventKit.framework). The Event Kit framework provides an interface for accessing a user’s calendar events and reminder items. You can use the APIs in this framework to get existing events and add new events to the user’s calendar. Calendar events can include alarms that you can configure with rules for when they should be delivered.

Note: The Calendar Store framework (CalendarStore.framework) is deprecated in OS X v10.8. You should use the programming interfaces of the Event Kit framework instead.

You can also use Event Kit APIs to access the user’s reminders, create new reminders, add an alarm to a reminder, and mark a reminder as complete.

  • Game Kit (GameKit.framework). As described in “Game Center,” the Game Kit framework provides APIs that allow your app to participate in Game Center. You can use Game Kit APIs to display leaderboards in your game, and to give users the opportunity to share their in-game achievements and play multiplayer games. To learn more about using Game Kit APIs in your app, see Game Kit Framework Reference.
  • GLKit (GLKit.framework). The GLKit framework provides libraries of commonly needed functions and classes that can help reduce the effort required to create an OpenGL app. In addition, the GLKit framework provides APIs that help you perform several optimized mathematical operations, reduce the effort in loading texture data, and render using provided effects.To learn more about using GLKit APIs in your app, see GLKit Framework Reference.
  • Twitter (Twitter.framework). The Twitter framework allows you to interact with the Twitter service. For example, using a configured Twitter account, you can send status updates (that is, “tweets”) on behalf of the user, which can also include location information and media attachments. Additionally, this framework provides classes for interacting with the Twitter developer API.
  • Video Toolbox (VideoToolbox.framework). Video Toolbox is the 64-bit replacement for the QuickTime Image Compression Manager. The Video Toolbox framework provides services for video compression and decompression, and for conversion between raster image formats stored in Core Video pixel buffers.

Drag and Drop text file on MacOS X application

Looking for this answer on the internet, I didn’t find a compiled solution for this issue. So I decided to make a simple tutorial how to build an app that act as a drag destination of a text file.

How does it works?

MacOS has a sofisticated drag-and-drop operation’s to use in your application or between applications. Using this capabilities your application could act as a Dragging Source, a Drag Destination or both.

Create our solution

1) create a new project “Cocoa Application” in Xcode named DragTest.

2) create a new file “objective-c class” named DragDropView.

To implement the drag-and-drop behavior you will need this methods:

- (NSDragOperation)draggingEntered:(id)sender

(Invoked when the dragged image enters destination bounds or frame)

- (BOOL)prepareForDragOperation:(id)sender

(Invoked when the image is released)

- (BOOL)performDragOperation:(id < NSDraggingInfo >)sender

(Invoked after the released image has been removed from the screen)

- (void)concludeDragOperation:(id)sender

(Invoked when the dragging operation is complete)

Here the implementation:

#import "DragDropView.h"

@implementation DragDropView

- (id)initWithFrame:(NSRect)frame{
    self = [super initWithFrame:frame];
    if (self) {
        [self registerForDraggedTypes:[NSArray arrayWithObject:NSFilenamesPboardType]];
    }
    return self;
}

- (NSDragOperation)draggingEntered:(id <NSDraggingInfo>)sender{
    highlight=YES;
    [self setNeedsDisplay: YES];
	return NSDragOperationGeneric;
}

- (void)draggingExited:(id <NSDraggingInfo>)sender{
    highlight=NO;
    [self setNeedsDisplay: YES];
}

- (BOOL)prepareForDragOperation:(id <NSDraggingInfo>)sender {
    highlight=NO;
    [self setNeedsDisplay: YES];
    return YES;
}

- (BOOL)performDragOperation:(id < NSDraggingInfo >)sender {
    NSArray *draggedFilenames = [[sender draggingPasteboard] propertyListForType:NSFilenamesPboardType];
    if ([[[draggedFilenames objectAtIndex:0] pathExtension] isEqual:@"txt"]){
        return YES;
    } else {
        return NO;
    }
}

- (void)concludeDragOperation:(id <NSDraggingInfo>)sender{
    NSArray *draggedFilenames = [[sender draggingPasteboard] propertyListForType:NSFilenamesPboardType];
    NSString *textDataFile = [NSString stringWithContentsOfFile:[draggedFilenames objectAtIndex:0] encoding:NSUTF8StringEncoding error:nil];

    NSLog(@"%@", textDataFile);
}

- (void)drawRect:(NSRect)rect{
    [super drawRect:rect];
    if ( highlight ) {
        [[NSColor grayColor] set];
        [NSBezierPath setDefaultLineWidth: 5];
        [NSBezierPath strokeRect: [self bounds]];
    }
}

@end

3) Now, select the MainMenu.xib.

4) Drop one CustomView into the Window.

5) in the “identity inspector” tab, in the “custom class” comboBox select the DragDropView.

it’s done !

How to install Java for Mac OS X 10.7 Lion

  • Go to Applications -> Utilities -> Java Preferences, and open it
  • Make sure you are connected to Internet. Simply click install, and after accepting the license agreement, your Java runtime will be downloaded and installed.

RoadMap to install or update to OSX 10.7 Lion

lion.175x175-75

 

To help everyone who wants to install Lion I decided to create a RoadMap:

1) Verify if your hardware is compatible. In order to install Mac OS X 10.7 you will need:
  • Intel Core 2 Duo, Core i3, Core i5, Core i7, or Xeon processor
  • 2GB of RAM
  • Mac OS X 10.6.6 or later with the Mac App Store installed
  • At least 4GB of additional disk space to accommodate the download, but more is obviously recommended
2) Verify if all apps you need are Lion compatible. You can see about apps compatibility at:

http://roaringapps.com/

3) Backup all your data. The best way to do that is buy an external HD and use Time Machine. To do that take a look at this article:

http://support.apple.com/kb/ht1427

3) Purchase and download Lion from the Mac App Store on any Lion compatible Mac running Snow Leopard:

http://itunes.apple.com/us/app/os-x-lion/id444303913?mt=12

4) Make a USB drive or DVD image of the Lion’s installation
  • Right click on “Mac OS X Lion” installer and choose the option to “Show Package Contents.”
  • Inside the Contents folder that appears you will find a SharedSupport folder and inside the SharedSupport folder you will find the “InstallESD.dmg.” This is the Lion boot disc image we have all been waiting for.
  • Copy “InstallESD.dmg” to another folder like the Desktop.
  • Launch Disk Utility and click the burn button.
  • Select the copied “InstallESD.dmg” as the image to burn, insert a standard sized 4.7 GB DVD, and wait for your new Lion Boot Disc to come out toasty hot.
5) Run the installation



Premium Wordpress Plugin