顯示具有 [Programming]Mac OS 標籤的文章。 顯示所有文章
顯示具有 [Programming]Mac OS 標籤的文章。 顯示所有文章

2014年7月29日 星期二

[Xcode] Fixed: Build error that it import Objective-C codes in the .cpp?

Build error: (NSObjCRuntime.h & NSObject)

/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSObjCRuntime.h:371:1: Expected unqualified-id

/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSObjCRuntime.h:373:19: Unknown type name 'NSString'
...

/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/objc/NSObject.h:11:1: Expected unqualified-id
...


[Solution]
rename extension name from .cpp into .mm

[Xcode] Fixed: _CMAudioFormatDescriptionGetStreamBasicDescription", referenced from: -[captureNSObject init] in captureNSObject.o

I have a project to build some code,  and then it has error in the follow:

Undefined symbols for architecture x86_64:
  "_CMAudioFormatDescriptionGetStreamBasicDescription", referenced from:
      -[captureNSObject init] in captureNSObject.o
  "_CMSampleBufferGetAudioBufferListWithRetainedBlockBuffer", referenced from:
      -[captureNSObject captureOutput:didOutputSampleBuffer:fromConnection:] in captureNSObject.o
  "_CMSampleBufferGetNumSamples", referenced from:
      -[captureNSObject captureOutput:didOutputSampleBuffer:fromConnection:] in captureNSObject.o
ld: symbol(s) not found for architecture x86_64

clang: error: linker command failed with exit code 1 (use -v to see invocation)

[Solution]
Add CoreMedia.framework into "Linked Frameworks and Libraries".

2014年7月24日 星期四

[Xcode] Enable/disable a button

@property (retain, nonatomic) IBOutlet UIButton *btnButton;
enable/disable like this in .m file:
btnButton.enabled = NO; // disable button
btnButton.enabled = YES; // enable button

2014年7月16日 星期三

[Xcode] How to quit the application when the window closes

If you want an application to quit (terminate) when the window is closed, you can do this:

-(BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication*)theApplication
{
    return YES;
}

2014年7月2日 星期三

[Xcode] Hotkey

command + X
- cut

command + C
- copy

command  + V
- paste

command + A
- select all

command + /
- add/remove comment

command + \
- add/remove breakpoint

command + R
- run

command + B
- build

command + F
- find

shift + command + F
- find in project

command + option + F
- find and replace

shift + command + option + F
- find and replace in project

2014年6月11日 星期三

[Mac OS] How To Capture a Screen Shot with Mac OS X

1. Command+Shift+3
   To capture the entire desktop, and then will be automatically saved as a PNG file on your desktop.

2. Command+Control+Shift+3
   To copy the entire desktop, and then will be placed on your clipboard for you to paste into another program.

3. Command+Shift+4
    To capture a portion of the desktop. A cross-hair cursor will appear and you can click and drag to select the area you wish to capture. When you release the mouse button, the screen shot will be automatically saved as a PNG file on your desktop. (The file is saved as PDF in Mac OS 10.3 and earlier.)

4. Command+Shift+4, then press the Spacebar
   To capture a specific application window. The cursor will change to a camera, and you can move it around the screen. As you move the cursor over an application window, the window will be highlighted. The entire window does not need to be visible for you to capture it. When you have the cursor over a window you want to capture, just click the mouse button and the screen shot will be saved as a PNG file on your desktop. (The file is saved as PDF in Mac OS 10.3 and earlier.)