Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

MapboxGL on XCode Version 7.0 beta #1870

Closed
danielgomezrico opened this issue Jul 10, 2015 · 15 comments
Closed

MapboxGL on XCode Version 7.0 beta #1870

danielgomezrico opened this issue Jul 10, 2015 · 15 comments

Comments

@danielgomezrico
Copy link

I´m one of those horrible compile error with the simple example on https://www.mapbox.com/mapbox-gl-ios/examples/. :(

My pod file:

source 'https://github.com/CocoaPods/Specs.git'
use_frameworks!
pod 'MapboxGL'

My view controller:

import UIKit
import MapboxGL

class MapViewController : UIViewController, MGLMapViewDelegate {

    override func viewDidLoad() {
        super.viewDidLoad()

        let mapView = MGLMapView(frame: view.bounds)
        mapView.autoresizingMask = [UIViewAutoresizing.FlexibleWidth, UIViewAutoresizing.FlexibleHeight]

        // set the map's center coordinate
        mapView.setCenterCoordinate(CLLocationCoordinate2D(latitude: 40.7326808,
            longitude: -73.9843407),
            zoomLevel: 12, animated: false)

        view.addSubview(mapView)
    }

}

Error:

Undefined symbols for architecture x86_64:
  "_OBJC_CLASS_$_MGLMapView", referenced from:
      type metadata accessor for ObjectiveC.MGLMapView in MapViewController.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Is it a bug on Xcode or is mine?

@1ec5
Copy link
Contributor

1ec5 commented Jul 10, 2015

Hi @danielgomezrico, this is a duplicate of #1849, which is caused by the new version of CocoaPods. Please add -ObjC to the OTHER_LDFLAGS (Other Linker Flags) build setting of your application target.

@1ec5 1ec5 closed this as completed Jul 10, 2015
@danielgomezrico
Copy link
Author

@1ec5 But I have it...

screen shot 2015-07-09 at 9 27 31 pm

@friedbunny
Copy link
Contributor

In that case, @danielgomezrico, you should try the voodoo dance of ⌘⇧K (CMD+SHIFT+K) and ⌘⌥⇧K (CMD+OPTION+SHIFT+K) to clean everything out.

@1ec5
Copy link
Contributor

1ec5 commented Jul 10, 2015

You may also need to mark Pods.framework as optional instead of required in the General tab.

@1ec5
Copy link
Contributor

1ec5 commented Jul 10, 2015

Oh, sorry, I had the workaround slightly wrong. Please see this comment for the real workaround: #1862 (comment).

@wangqianjun
Copy link

I have the same problem:

Undefined symbols for architecture x86_64:
"OBJC_CLASS$_MGLMapView", referenced from:
objc-class-ref in ViewController.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Xcode 6.4
OSX Yosemite 10.10.4

Now what should I do?

@1ec5
Copy link
Contributor

1ec5 commented Jul 29, 2015

@wangqianjun, what version of CocoaPods and what version of MapboxGL do you have installed?

@AndrewBarba
Copy link

Same problem using Xcode 6.4 and CocoaPods 0.38.2. I checked all of the linker flags, and -ObjC is there. Simply have pod 'MapboxGL' in Podfile so assuming that is latest version

@1ec5
Copy link
Contributor

1ec5 commented Aug 18, 2015

It sounds like CocoaPods has failed to set up the workspace correctly, but the same version of CocoaPods works for me. @wangqianjun and @AndrewBarba, please try installing Mapbox GL into a brand-new project. If it still exibits this issue, please ZIP up the project (podspec and all) and send it to mobile@mapbox.com, referencing this GitHub issue. Thank you!

@AndrewBarba
Copy link

Before I actually do that, you guys have use_frameworks! listed in Podfile but also have min platform as iOS 7.0. Everything I'm reading says that is not possible. 7.0 doesn't support frameworks so I'm not sure how anyone got that to work. Regardless I tried it with and without that line on both min targets of iOS 7 and iOS 8 and could not get it to build. With that line on a min target of iOS 7 pretty much everything blew up, on iOS 8 the Facebook SDK was having problems, I fixed those with build settings but then same error with Mapbox.

@1ec5
Copy link
Contributor

1ec5 commented Aug 19, 2015

@AndrewBarba, using a dynamic framework is required if you use Swift, as the others on this page appear to be doing, because Swift code cannot link against static libraries. It is possible to run an application linked against frameworks on iOS 7; Xcode issues a warning, but that appears to be a bug in Xcode.

Are you getting exactly the same linker error as the original reporter, or something different?

@AndrewBarba
Copy link

Sorry to be completely spitballing here (DF reader, really want to use this) but your podspec is using m.xcconfig which isn't listed in Pod docs. Have you looked at using:

  1. https://guides.cocoapods.org/syntax/podspec.html#pod_target_xcconfig
  2. https://guides.cocoapods.org/syntax/podspec.html#compiler_flags

@1ec5
Copy link
Contributor

1ec5 commented Aug 19, 2015

http://corinnekrych.blogspot.com/2015/04/how-well-does-swift-plays-on-ios7.html (read first comment)

I stand corrected. But CocoaPods/swift#9 (comment) is pretty much spot on. In fact, the main benefit we’ve gotten from CocoaPods has been its ability to wrap the static library in a dynamic framework (something we’ve been planning to roll at home for #828). However, if you’re running into the validation issue because you’re backwards-deploying to iOS 7.0, you may want to consider the manual installation route, unless you’re using CocoaPods for any other packages.

your podspec is using m.xcconfig which isn't listed in Pod docs

Looks like our use of xcconfig dates back to cutting-room-floor/mapbox-gl-cocoa@906a1bb. pod_target_xcconfig and compiler_flags only replaced xcconfig quite recently in CocoaPods/CocoaPods#3573 in 0.38.0. I’ve opened #2132 to move over to the new flag, though I don’t know if we want to require the newest CocoaPods version so soon. Besides the Facebook SDK, what other CocoaPods packages are you using in your project?

@AndrewBarba
Copy link

We're using quite a few

pod 'Fabric'
pod 'Crashlytics'
pod 'mopub-ios-sdk'
pod 'Braintree'
pod 'TLKit'
pod 'Button'

And TLKit, which is our private pod, uses:

k.dependency 'AFNetworking', '~> 2.5'
k.dependency 'SSKeychain', '~> 1.2'
k.dependency 'PocketSocket', '~> 0.6'
k.dependency 'FBSDKCoreKit', '~> 4.1'
k.dependency 'FBSDKLoginKit', '~> 4.1'
k.dependency 'SDWebImage', '~> 3.7'

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants