Created
October 26, 2014 10:37
-
-
Save jake1256/9386f26024cc5132b421 to your computer and use it in GitHub Desktop.
【iOS】Xcodeでビルドした時にNSObjCRuntimeでエラー?【cocos2d-x】 ref: http://qiita.com/kuuki_yomenaio/items/6edc7cb16a81d2bc9ef5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator8.0.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSObjCRuntime.h:397:1: error: expected unqualified-id | |
@class NSString, Protocol; | |
^ | |
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator8.0.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSObjCRuntime.h:399:19: error: unknown type name 'NSString' | |
FOUNDATION_EXPORT NSString *NSStringFromSelector(SEL aSelector); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// NativeUtil.cpp | |
#include "NativeUtil.h" | |
#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS) | |
#import <objc/runtime.h> | |
#import <Foundation/Foundation.h> | |
#import <UIKit/UIKit.h> | |
#endif | |
/** | |
* URLを指定して端末ブラウザと連携する | |
*/ | |
void NativeUtil::showWebBrowser(std::string url) | |
{ | |
NSString *urlString = [NSString stringWithFormat:@"%s" , url.c_str()]; | |
NSURL *nsUrl = [NSURL URLWithString:urlString]; | |
// ブラウザを起動する | |
[[UIApplication sharedApplication] openURL:nsUrl]; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// NativeUtil.h | |
#ifndef __Cocos2dxNSObjCRuntimeErrorTest__NativeUtil__ | |
#define __Cocos2dxNSObjCRuntimeErrorTest__NativeUtil__ | |
#include <stdio.h> | |
class NativeUtil | |
{ | |
public: | |
static void showWebBrowser(std::string url); | |
}; | |
#endif /* defined(__Cocos2dxNSObjCRuntimeErrorTest__NativeUtil__) */ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment