我正在嘗試構建一個使用Growl的基本可可應用程序。有沒有辦法使用GrowlApplicationBridge沒有NSClassFromString?
每次我想用GrowlApplicationBridge
我有使用類似
Class GAB = NSClassFromString(@"GrowlApplicationBridge");
[GAB performSelector:@selector(setGrowlDelegate:) withObject:self];
我希望能夠只使用
[GrowlApplicationBridge setGrowlDelegate:self];
這裏的編譯器錯誤,我得到的,當我嘗試我想要的行爲:
Undefined symbols for architecture x86_64: "_OBJC_CLASS_$_GrowlApplicationBridge", referenced from: objc-class-ref in StatusMenuAppDelegate.o ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation)
謝謝:)我在複製框架而不是鏈接它。 – Cyrus
@Cyrus:你需要做這兩件事。如果你不復制它,你的應用程序將無法啓動,因爲你的用戶不會擁有它。如果你沒有鏈接它,複製它是沒有用的。您必須複製它(以便它會出現在用戶的機器上)並鏈接到它(以便您的應用程序將實際使用它)。 –
明白了。謝謝你的幫助。 – Cyrus