【发布时间】:2017-02-15 05:49:52
【问题描述】:
我正在一个带有地图框架的项目中工作,一切都很好,直到我开始推送通知并在我的 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 个相同的错误。 我之前没有任何问题,我几乎尝试了我在这里找到的所有解决方案。
架构 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 >)",引用自: G3MScenarioDEMDemoScene.o 中的 G3MScenarioDEMDemoScene::rawActivate(G3MContext const) G3MVectorialDemoScene::rawActivate(G3MContext const*) 在 G3MVectorialDemoScene.o G3MPointCloudDemoScene.o 中的 G3MPointCloudDemoScene::rawActivate(G3MContext const*) G3MAnimatedMarksDemoScene.o 中的 G3MAnimatedMarksDemoScene::rawActivate(G3MContext const*) G3MStereoDemoScene.o 中的 G3MStereoDemoScene::rawActivate(G3MContext const*) G3MVectorStreaming2DemoScene::rawActivate(G3MContext const*) 在 G3MVectorStreaming2DemoScene.o G3MStreamingPointCloud2DemoScene::rawActivate(G3MContext const*) 在 G3MStreamingPointCloud2DemoScene.o ... “GEOVectorLayer::GEOVectorLayer(int, int, int, int, float, LayerCondition const*, std::__1::vector >)”,引用自: G3MVectorialDemoScene::rawActivate(G3MContext const) 在 G3MVectorialDemoScene.o G3M3DSymbologyDemoScene.o 中的 G3M3DSymbologyDemoScene::rawActivate(G3MContext const*) "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)”,引用自: G3MMarksDemoScene_BufferDownloadListener::onDownload(URL const&, IByteBuffer*, bool) 在 G3MMarksDemoScene.o “Layer::setTitle(std::__1::basic_string, std::__1::allocator > const&)”,引用自: - [ParkingViewController createLayerSet] 在 ParkingViewController.o G3MRasterLayersDemoScene::createLayerSet(LayerSet*) 在 G3MRasterLayersDemoScene.o “std::string::erase(__gnu_cxx::__normal_iterator, __gnu_cxx::__normal_iterator)”,引用自: 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)”,引用自: 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*)”,引用自: libG3MiOSSDK.a(G3MWidget_iOS.o) 中的 StringBuilder_iOS::addBool(bool) libG3MiOSSDK.a(IntBuffer_iOS.o) 中的 IntBuffer_iOS::description() const libG3MiOSSDK.a(FloatBuffer_iOS.o) 中的 FloatBuffer_iOS::description() 常量 libG3MiOSSDK.a(ShortBuffer_iOS.o) 中的 ShortBuffer_iOS::description() 常量 “std::basic_ostream >& std::operator(std::basic_ostream >&, std::basic_string, std::allocator > const&)”,引用自: StringBuilder_iOS::addString(std::string const&) 在 libG3MiOSSDK.a(G3MWidget_iOS.o) StringUtils_iOS::parseHexInt(std::string const&) const in libG3MiOSSDK.a(StringUtils_iOS.o) ld:未找到架构 x86_64 的符号 clang:错误:链接器命令失败,退出代码为 1(使用 -v 查看调用) 仅显示前 200 个通知
如果您需要更多信息,请告诉我。
谢谢。
【问题讨论】:
-
我仍然有问题尝试解决它并且错误更改为 ARC 问题,我将 -fno-objc-arc 添加到某些文件的编译器标志并解决了问题但又回来了带有架构 x86_64 的未定义符号:但现在我只有 24 个...有人可以帮帮我吗?
标签: xcode xcode8 undefined-symbol