架构的错误未定义符号 x86_64:
Error Undefined symbols for architecture x86_64:
我正在一个带有地图框架的项目中工作,一切都很好,直到我开始推送通知并在我的 AppDelegate.h 中写入 @property bool push;
。我的 AppDelegate.m
里有这个
(void)application:(UIApplication*)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData*)deviceToken
{
NSString *key =[[NSUserDefaults standardUserDefaults] stringForKey:@"token"];
if ( key== nil || [key isEqual:@""])
{
_push=true;
NSString* token = [[[[deviceToken description] stringByReplacingOccurrencesOfString: @"<" withString: @""] stringByReplacingOccurrencesOfString: @">" withString: @""] stringByReplacingOccurrencesOfString: @" " withString: @""] ;
NSLog(@"=== Device token: %@", token);
NSUserDefaults *userdefault = [NSUserDefaults standardUserDefaults];
[userdefault setObject:token forKey:@"token"];
NSString *jsonPostBody = [NSString stringWithFormat:@"{\"token\":"
"\"%@\""
",\"type\":"
"\"ios\""
"}",
[token stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
NSData *postData = [jsonPostBody dataUsingEncoding:NSUTF8StringEncoding allowLossyConversion:YES];
NSURL *url = [NSURL URLWithString:@"http://www.turismolapalmadelcondado.es/es/api/push_notifications"];
NSMutableURLRequest* request = [NSMutableURLRequest requestWithURL:url
cachePolicy:NSURLRequestReloadIgnoringLocalCacheData
timeoutInterval:180.0];
[request setHTTPMethod:@"POST"];
[request setHTTPBody:postData];
NSString* postDataLengthString = [[NSString alloc]initWithFormat: @"%d", [postData length]];
[request setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
[request setValue:postDataLengthString forHTTPHeaderField:@"Content-Length"];
NSURLResponse *response = nil;
NSError *error = nil;
NSData *data=[NSURLConnection sendSynchronousRequest:request returningResponse:&response error:&error];
NSHTTPURLResponse *httpResponse = response;
NSLog(@"response text: %@",[[NSString alloc]initWithData:data encoding:NSUTF8StringEncoding] );
NSLog(@"response status code: %ld", (long)[httpResponse statusCode]);
}
}
问题是,如果我没有定义 push,我会在 AppDelegate.m 中出现错误,但如果我定义了它,那么在框架中会有 93 个相同的错误。
我之前没有任何问题,我几乎尝试了我在这里找到的所有解决方案。
Undefined symbols for architecture x86_64:
"BingMapsLayer::BingMapsLayer(std::__1::basic_string, std::__1::allocator > const&, std::__1::basic_string, std::__1::allocator > const&, TimeInterval const&, bool, int, int, float, LayerCondition const*, std::__1::vector >)", referenced from:
G3MScenarioDEMDemoScene::rawActivate(G3MContext const) in G3MScenarioDEMDemoScene.o
G3MVectorialDemoScene::rawActivate(G3MContext const*) in G3MVectorialDemoScene.o
G3MPointCloudDemoScene::rawActivate(G3MContext const*) in G3MPointCloudDemoScene.o
G3MAnimatedMarksDemoScene::rawActivate(G3MContext const*) in G3MAnimatedMarksDemoScene.o
G3MStereoDemoScene::rawActivate(G3MContext const*) in G3MStereoDemoScene.o
G3MVectorStreaming2DemoScene::rawActivate(G3MContext const*) in G3MVectorStreaming2DemoScene.o
G3MStreamingPointCloud2DemoScene::rawActivate(G3MContext const*) in G3MStreamingPointCloud2DemoScene.o
...
"GEOVectorLayer::GEOVectorLayer(int, int, int, int, float, LayerCondition const*, std::__1::vector >)", referenced from:
G3MVectorialDemoScene::rawActivate(G3MContext const) in G3MVectorialDemoScene.o
G3M3DSymbologyDemoScene::rawActivate(G3MContext const*) in G3M3DSymbologyDemoScene.o
"Mark::Mark(std::__1::basic_string, std::__1::allocator > const&, URL const&, Geodetic3D const&, AltitudeMode, double, bool, float, Color const*, Color const*, int, MarkUserData*, bool, MarkTouchListener*, bool)", referenced from:
G3MMarksDemoScene_BufferDownloadListener::onDownload(URL const&, IByteBuffer*, bool) in G3MMarksDemoScene.o
"Layer::setTitle(std::__1::basic_string, std::__1::allocator > const&)", referenced from:
-[ParkingViewController createLayerSet] in ParkingViewController.o
G3MRasterLayersDemoScene::createLayerSet(LayerSet*) in G3MRasterLayersDemoScene.o
"std::string::erase(__gnu_cxx::__normal_iterator, __gnu_cxx::__normal_iterator)", referenced from:
StringUtils_iOS::ltrim(std::string const&) const in libG3MiOSSDK.a(StringUtils_iOS.o)
StringUtils_iOS::rtrim(std::string const&) const in libG3MiOSSDK.a(StringUtils_iOS.o)
"std::string::erase(unsigned long, unsigned long)", referenced from:
StringUtils_iOS::replaceAll(std::string const&, std::string const&, std::string const&) const in libG3MiOSSDK.a(StringUtils_iOS.o)
"std::basic_ostream >& std::operator<< >(std::basic_ostream >&, char const*)", referenced from:
StringBuilder_iOS::addBool(bool) in libG3MiOSSDK.a(G3MWidget_iOS.o)
IntBuffer_iOS::description() const in libG3MiOSSDK.a(IntBuffer_iOS.o)
FloatBuffer_iOS::description() const in libG3MiOSSDK.a(FloatBuffer_iOS.o)
ShortBuffer_iOS::description() const in libG3MiOSSDK.a(ShortBuffer_iOS.o)
"std::basic_ostream >& std::operator<<, std::allocator >(std::basic_ostream >&, std::basic_string, std::allocator > const&)", referenced from:
StringBuilder_iOS::addString(std::string const&) in libG3MiOSSDK.a(G3MWidget_iOS.o)
StringUtils_iOS::parseHexInt(std::string const&) const in libG3MiOSSDK.a(StringUtils_iOS.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Showing first 200 notices only
如果您需要更多信息,请告诉我。
谢谢。
我终于能够修复错误。我在特定框架中遇到错误,但也许我可以帮助某人。这确实是一个配置错误项目,如果你像我一样使用开源框架,请仔细阅读文档以了解需求,在我的情况下,我需要两件事才能让它工作但我找不到,我不知道是谁在看直到我看到一些需要和不需要的文件。除此之外,ios 框架的版本或诸如启用或不启用 Bitcode 或 arc 之类的东西,在我的情况下,我必须在调试中启用 Bitcode,但在发布时不启用。要了解这一点,只需查看患者的框架设置即可。希望我的经验可以帮助到一些人。
我正在一个带有地图框架的项目中工作,一切都很好,直到我开始推送通知并在我的 AppDelegate.h 中写入 @property bool push;
。我的 AppDelegate.m
(void)application:(UIApplication*)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData*)deviceToken
{
NSString *key =[[NSUserDefaults standardUserDefaults] stringForKey:@"token"];
if ( key== nil || [key isEqual:@""])
{
_push=true;
NSString* token = [[[[deviceToken description] stringByReplacingOccurrencesOfString: @"<" withString: @""] stringByReplacingOccurrencesOfString: @">" withString: @""] stringByReplacingOccurrencesOfString: @" " withString: @""] ;
NSLog(@"=== Device token: %@", token);
NSUserDefaults *userdefault = [NSUserDefaults standardUserDefaults];
[userdefault setObject:token forKey:@"token"];
NSString *jsonPostBody = [NSString stringWithFormat:@"{\"token\":"
"\"%@\""
",\"type\":"
"\"ios\""
"}",
[token stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
NSData *postData = [jsonPostBody dataUsingEncoding:NSUTF8StringEncoding allowLossyConversion:YES];
NSURL *url = [NSURL URLWithString:@"http://www.turismolapalmadelcondado.es/es/api/push_notifications"];
NSMutableURLRequest* request = [NSMutableURLRequest requestWithURL:url
cachePolicy:NSURLRequestReloadIgnoringLocalCacheData
timeoutInterval:180.0];
[request setHTTPMethod:@"POST"];
[request setHTTPBody:postData];
NSString* postDataLengthString = [[NSString alloc]initWithFormat: @"%d", [postData length]];
[request setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
[request setValue:postDataLengthString forHTTPHeaderField:@"Content-Length"];
NSURLResponse *response = nil;
NSError *error = nil;
NSData *data=[NSURLConnection sendSynchronousRequest:request returningResponse:&response error:&error];
NSHTTPURLResponse *httpResponse = response;
NSLog(@"response text: %@",[[NSString alloc]initWithData:data encoding:NSUTF8StringEncoding] );
NSLog(@"response status code: %ld", (long)[httpResponse statusCode]);
}
}
问题是,如果我没有定义 push,我会在 AppDelegate.m 中出现错误,但如果我定义了它,那么在框架中会有 93 个相同的错误。 我之前没有任何问题,我几乎尝试了我在这里找到的所有解决方案。
Undefined symbols for architecture x86_64: "BingMapsLayer::BingMapsLayer(std::__1::basic_string, std::__1::allocator > const&, std::__1::basic_string, std::__1::allocator > const&, TimeInterval const&, bool, int, int, float, LayerCondition const*, std::__1::vector >)", referenced from: G3MScenarioDEMDemoScene::rawActivate(G3MContext const) in G3MScenarioDEMDemoScene.o G3MVectorialDemoScene::rawActivate(G3MContext const*) in G3MVectorialDemoScene.o G3MPointCloudDemoScene::rawActivate(G3MContext const*) in G3MPointCloudDemoScene.o G3MAnimatedMarksDemoScene::rawActivate(G3MContext const*) in G3MAnimatedMarksDemoScene.o G3MStereoDemoScene::rawActivate(G3MContext const*) in G3MStereoDemoScene.o G3MVectorStreaming2DemoScene::rawActivate(G3MContext const*) in G3MVectorStreaming2DemoScene.o G3MStreamingPointCloud2DemoScene::rawActivate(G3MContext const*) in G3MStreamingPointCloud2DemoScene.o ... "GEOVectorLayer::GEOVectorLayer(int, int, int, int, float, LayerCondition const*, std::__1::vector >)", referenced from: G3MVectorialDemoScene::rawActivate(G3MContext const) in G3MVectorialDemoScene.o G3M3DSymbologyDemoScene::rawActivate(G3MContext const*) in G3M3DSymbologyDemoScene.o "Mark::Mark(std::__1::basic_string, std::__1::allocator > const&, URL const&, Geodetic3D const&, AltitudeMode, double, bool, float, Color const*, Color const*, int, MarkUserData*, bool, MarkTouchListener*, bool)", referenced from: G3MMarksDemoScene_BufferDownloadListener::onDownload(URL const&, IByteBuffer*, bool) in G3MMarksDemoScene.o "Layer::setTitle(std::__1::basic_string, std::__1::allocator > const&)", referenced from: -[ParkingViewController createLayerSet] in ParkingViewController.o G3MRasterLayersDemoScene::createLayerSet(LayerSet*) in G3MRasterLayersDemoScene.o "std::string::erase(__gnu_cxx::__normal_iterator, __gnu_cxx::__normal_iterator)", referenced from: StringUtils_iOS::ltrim(std::string const&) const in libG3MiOSSDK.a(StringUtils_iOS.o) StringUtils_iOS::rtrim(std::string const&) const in libG3MiOSSDK.a(StringUtils_iOS.o) "std::string::erase(unsigned long, unsigned long)", referenced from: StringUtils_iOS::replaceAll(std::string const&, std::string const&, std::string const&) const in libG3MiOSSDK.a(StringUtils_iOS.o) "std::basic_ostream >& std::operator<< >(std::basic_ostream >&, char const*)", referenced from: StringBuilder_iOS::addBool(bool) in libG3MiOSSDK.a(G3MWidget_iOS.o) IntBuffer_iOS::description() const in libG3MiOSSDK.a(IntBuffer_iOS.o) FloatBuffer_iOS::description() const in libG3MiOSSDK.a(FloatBuffer_iOS.o) ShortBuffer_iOS::description() const in libG3MiOSSDK.a(ShortBuffer_iOS.o) "std::basic_ostream >& std::operator<<, std::allocator >(std::basic_ostream >&, std::basic_string, std::allocator > const&)", referenced from: StringBuilder_iOS::addString(std::string const&) in libG3MiOSSDK.a(G3MWidget_iOS.o) StringUtils_iOS::parseHexInt(std::string const&) const in libG3MiOSSDK.a(StringUtils_iOS.o) ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) Showing first 200 notices only
如果您需要更多信息,请告诉我。
谢谢。
我终于能够修复错误。我在特定框架中遇到错误,但也许我可以帮助某人。这确实是一个配置错误项目,如果你像我一样使用开源框架,请仔细阅读文档以了解需求,在我的情况下,我需要两件事才能让它工作但我找不到,我不知道是谁在看直到我看到一些需要和不需要的文件。除此之外,ios 框架的版本或诸如启用或不启用 Bitcode 或 arc 之类的东西,在我的情况下,我必须在调试中启用 Bitcode,但在发布时不启用。要了解这一点,只需查看患者的框架设置即可。希望我的经验可以帮助到一些人。