0
votes

I'm working in a project with a map framework and all it's fine until I starts with the push notifications and write @property bool push; in my the AppDelegate.h. I have this in my 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]);
}

}

The thing is that if I don't define push I have a error in the AppDelegate.m but If I do it have 93 with the same error in the framework. I didn't have any problem before and I almost tried all the solutions I've found here.

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

If you need something more information, please tell me.

Thanks.

1
I still with the problem try to solve it and the error change for a problem with the ARC, I added -fno-objc-arc to the compiler flags for some files and solve the problem but comeback again with the Undefined symbols for architecture x86_64: but now I only have 24... Can anyone help me?Melexia

1 Answers

0
votes

Finally I was able to fix the error. I had the error in a specific framework but maybe I can help someone. It really was a configuration error project, if you're using as me an opensource framework read the documentation carefully to requirements, in my case was two things that I need to make it work and I couldn't find, I knew not who waslooking until I saw some files that need and don't have. Apart from this, the version of ios of framework or things like enabling or not Bitcode or arc, in my case I had to enable Bitcode in debug but not in release. To know this just looking at settings of framework an patiente. I hope mi experience can hepl someone.