2013年4月25日 星期四

ios compile error note

linker command failed with exit code 1
2 duplicate symbols for architecture i386
=> 上面詳細訊息有是什麼duplicate的資訊,可能是重複定義,可能是build phase內的compile sources重複加入

2013年4月5日 星期五

2013年3月18日 星期一

homebrew xcode opencv

use homebrew to install opencv

brew install opencv

and in xcode project

add
Header Search Paths: /usr/local/Cellar/opencv/   choose recursive
Library Search Paths: /usr/local/Cellar/opencv/   choose recursive
Other Linker Flags: -lopencv_core -lopencv_highgui -lopencv_imgproc (add other if you want to use other library)


Then you can write your opencv code!

Problem1: OpenCV Unresolved symbols
Ans: switched the compiler used in the XCode (Apple LLVM 4.1) to the LLVM GCC 4.2 and now it works!
http://stackoverflow.com/questions/13461400/opencv-unresolved-symbols-name-mangling-mismatch-xcode
Ans2:Under Build Settings>Apple LLVM compiler 4.1 - Language>C++ Standard Library: Change from libc++ (LLVM ...) to libstdc++ (GNU C++ ...).
http://stackoverflow.com/questions/12770115/linking-libraries-opencv-2-4-2-on-xcode-4-5-1?rq=1

2013年3月12日 星期二

ios iboutlet


今天遇到一个问题困扰了很久。 代码如下:
1
2
3
4
FileOverviewViewController *fileOverviewViewController = [[FileOverviewViewController alloc] initWithNibName:@"FileOverviewView" bundle:nil];
// AAAAA
[self.navigationController pushViewController:fileOverviewViewController animated:YES];
// BBBBBB
如果你有这个Controller中的view里面有IBOutlet的变量,如果你在A的地方进行赋值或者其他操作的话,界面将不会有任何更新,那些IBoutlet变量的值都为NULL, 如果在B处设置就可以正常显示了。
结论: 如果你使用navigation Controller的话, 一定要在push了这个ViewController之后再操作这个ViewController中的IBOutlet变量,否则这个变量会因为不在作用范围内而无法操作。
扩展开来也就是说只有当一个ViewController被载入处于活动状态的时候,这个ViewController中的IBOutlet变量才能正常使用,否则都会因为不在作用范围内而无法正常使用的
http://blog.prosight.me/index.php/2009/10/415


我今天試圖把iboutlet放在view上,
然後在initWithACoder去設定裡面的東西,
發現沒反應因為是null就是這個原因@@

最後就只好在view裡面開一個method,
當viewcontroller的viewdidload時執行此method來做設定。

ios function parameter using block


Example:
- (void)someFunc:(void(^)(void))someBlock;

- ( void )myMethodTakingPredicate: ( BOOL ( ^ )( int ) )predicate

2013年3月2日 星期六

urban airship

Header search path - Ensure that your project’s header search path includes the Airship directory (recursive).

use:
"$(SRCROOT)/Airship/" recursive

add header:
//urban airship
#import "UAirship.h"
#import "UAPush.h"

2013年2月24日 星期日

ruby on rails 相關更新指令


brew update
Updates your local database of available (and no longer available) installable packages otherwise know in brew terminology as Formulae.
brew upgrade
Updates all the installed packages on your system currently. E.g. Upgrading PHP 5.3.20 to 5.3.21.
brew search 搜尋套件
brew info 查詢套件資訊
brew list 已經裝了哪些套件
brew update 更新 homebrew 自己
brew install 安裝套件



sudo gem update
will update all your gems.
Later, if you want, you can do some 'cleaning'
sudo gem cleanup
what will delete all the previous versions and keep only the latest ones. In case of existing dependencies, you will be prompted before deleting.