Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error 'MapboxDirections/MapboxDirections.h' file not found after installing MapboxNavigation #318

Closed
paul019 opened this issue Nov 7, 2018 · 27 comments
Labels
build needs more information Can't proceed without more data.

Comments

@paul019
Copy link

paul019 commented Nov 7, 2018

Hi there,

I've installed MapboxNavigation iOS via CocoaPods without experiencing any issues. But after compiling the project in Xcode I got two errors produced by the library. One error is 'MapboxDirections/MapboxDirections.h' file not found:

bildschirmfoto 2018-11-05 um 20 40 35

I tried to just comment out the line of code that produced the error and the whole project indeed compiled successfully. As I can evaluate the import that produces the error isn't needed in the file at all. Is this true?

After doing this hacky bugfix, I started writing some lines of Mapbox code and got another error:

The code:

import Foundation
import UIKit
import MapboxCoreNavigation
import MapboxNavigation
import MapboxDirections
  ...
let navigationService = MapboxNavigationService(route: route, simulating: .always)
let navigationController = NavigationViewController(for: route, navigationService: navigationService)
viewController.addChildViewController(navigationController);
viewController.addSubview(navigationController.view);

The resulting error:
Command failed due to signal: Abort trap: 6

I've no clue what this error means and think that it may have something to do with my hacky bugfix. Is this possible?

Mapbox Navigation SDK version: 0.22.0

@paul019
Copy link
Author

paul019 commented Nov 8, 2018

@frederoni Do you have an idea how to solve this issues?

@paul019
Copy link
Author

paul019 commented Nov 10, 2018

@frederoni An answer would be very appreciated.

1 similar comment
@paul019
Copy link
Author

paul019 commented Nov 14, 2018

@frederoni An answer would be very appreciated.

@frederoni
Copy link
Contributor

Sorry about the delay.

What version of Xcode and what version of CocoaPods are you using? Do you see similar issues with newer versions of the Navigation SDK?

@paul019
Copy link
Author

paul019 commented Nov 14, 2018

@frederoni I tried out both Xcode 9.4 and Xcode 10. But I had the same issue with both versions. To the Navigation SDK: I tried out version 0.22.0 and 0.24.0. My CocoaPods version is 1.5.3.

@frederoni
Copy link
Contributor

frederoni commented Nov 14, 2018

@paul019 Can you share your Podfile? Feel free to leave out anything not relevant to Mapbox dependencies.

@paul019
Copy link
Author

paul019 commented Nov 14, 2018

Here's my Podfile:

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '9.0'

target 'my-target' do
  pod 'MapboxMobileEvents',
    :git => 'https://github.com/mapbox/mapbox-events-ios.git',
    :commit => "79d29f1df5a9187481f5c9ac8fa13430d1f04139"
  pod 'MapboxNavigation', '~> 0.24.0'
  ...
end

@paul019
Copy link
Author

paul019 commented Nov 14, 2018

@frederoni Could you find a problem with my Podfile?

@frederoni
Copy link
Contributor

Add use_frameworks! below platform :ios, '9.0' and it should work.

Feel free to re-open if the issue persists.

@paul019
Copy link
Author

paul019 commented Nov 19, 2018

@frederoni Thank you for the tip. Unfortunately, it doesn't work for me, because I am installing other Pods that throw an error when using use_frameworks!: [!] The 'Pods-pq-app-v2' target has transitive dependencies that include static binaries. Is there another possible option for me than defining use_frameworks! globally? I will also do research on whether its possible to use my other Pods with use_frameworks!...

PS: I cannot re-open the issue because you closed it (see https://stackoverflow.com/questions/21333654/how-to-re-open-an-issue-in-github). I hope you see this message anyway.

@frederoni frederoni reopened this Nov 19, 2018
@paul019
Copy link
Author

paul019 commented Nov 19, 2018

@frederoni So, do you have an idea, how I could install MapboxNavigation without the need to set use_frameworks!? Unfortunately, my other Pods do not support this global 'variable' at all.

@frederoni
Copy link
Contributor

Specifying use_framework individually is unfortunately not something that will be supported by CocoaPods. Perhaps you could work around the issue with pod 'MapboxNavigation', :modular_headers => true but I haven't made any progress so far. However, MapboxDirections.swift seem to be the culprit. MapboxSpeech and Polyline build just fine as static frameworks.

@1ec5 static libraries wrapped in a framework is the default in CocoaPods (as of 1.5?), supported on Xcode >= 9 and iOS >= 9. Any idea why MapboxDirections.swift’s umbrella header would be missing unless use_frameworks! is specified?

@paul019
Copy link
Author

paul019 commented Nov 21, 2018

@frederoni @1ec5 Now I've added :modular_headers => true to my Podfile:

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '9.0'

target 'my-app' do
  pod 'MapboxMobileEvents',
    :git => 'https://github.com/mapbox/mapbox-events-ios.git',
    :commit => "79d29f1df5a9187481f5c9ac8fa13430d1f04139"
  pod 'MapboxNavigation', '~> 0.24.0',
    :modular_headers => true
  ...
end

However, I still get the same error when running the project in Xcode after the pod repo update && pod install.

@paul019
Copy link
Author

paul019 commented Nov 22, 2018

@frederoni An answer would be very appreciated.

@frederoni
Copy link
Contributor

We don't have a solution for this issue yet. I will transfer this issue to MapboxDirections.swift and try to address it as soon as possible.

@frederoni frederoni transferred this issue from mapbox/mapbox-navigation-ios Nov 23, 2018
@mysport12
Copy link

mysport12 commented Dec 20, 2018

We are also running into this issue on our project. use_frameworks! causes other pods to fail. We are using MapboxNavigation v0.26.0 and Cocoapods v1.5.3.

@paul019
Copy link
Author

paul019 commented Dec 31, 2018

@frederoni When can we expect a solution to this issue?

@frederoni
Copy link
Contributor

frederoni commented Jan 2, 2019

It's not a long-term solution but I was able to work around this issue by renaming MapboxDirections.swift to MapboxDirections and using the following Podfile:

Podfile
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '9.0'

target 'my-app' do
  pod 'MapboxCoreNavigation', :path => '../mapbox-navigation-ios'
  pod 'MapboxNavigation', :path => '../mapbox-navigation-ios'
  pod 'MapboxMobileEvents', :modular_headers => true
  pod 'MapboxDirections', :path => '../MapboxDirections.swift', :modular_headers => true
end

along with renaming MapboxDirections.swift.podspec to MapboxDirections.podspec and edit MapboxCoreNavigation.podspec to depend on MapboxDirections instead of MapboxDirections.swift.

I know there was an issue with . in framework names in Xcode 6/7, but the bug seems to have re-surfaced, at least with static frameworks.

@paul019
Copy link
Author

paul019 commented Feb 10, 2019

@frederoni Thank you for your answer! I'm very sorry for not answering for such a long time.

I've now tried out your workaround, but unfortunately the pod repo update && pod install fails for me, if I use your Podfile. That's the error message that is thrown in the console:

[!] No podspec found for 'MapboxCoreNavigation' in '../mapbox-navigation-ios'

So, what's the problem here?

@1ec5
Copy link
Contributor

1ec5 commented Feb 18, 2019

The Podfile in #318 (comment) assumes you have a clone of the dependencies’ repositories beside the current project directory.

@1ec5
Copy link
Contributor

1ec5 commented Feb 18, 2019

static libraries wrapped in a framework is the default in CocoaPods (as of 1.5?), supported on Xcode >= 9 and iOS >= 9. Any idea why MapboxDirections.swift’s umbrella header would be missing unless use_frameworks! is specified?

It’s unusual that MapboxDirections-Swift.h tries to import MapboxDirections.h. By contrast, the generated interface for MapboxSpeech, MapboxSpeech.h, lacks this import statement.

#import <MapboxDirections/MapboxDirections.h>

There should be no reason for a library’s generated interface header to import the same library’s umbrella header. I think this may come down to the fact that MapboxDirections.swift’s pod name (MapboxDirections.swift) doesn’t match the product module name (MapboxDirections) and possibly that it contains “.swift”, which makes it look like a file.

@aliustaoglu
Copy link

I cannot use frameworks because of other dependencies. And as per #318 (comment) I renamed MapboxDirections.swift.podspec to MapboxDirections.podspec but still no luck. I get this error:

Redefinition of module 'MapboxDirections'

@1ec5
Copy link
Contributor

1ec5 commented Jan 12, 2020

There should be no reason for a library’s generated interface header to import the same library’s umbrella header. I think this may come down to the fact that MapboxDirections.swift’s pod name (MapboxDirections.swift) doesn’t match the product module name (MapboxDirections) and possibly that it contains “.swift”, which makes it look like a file.

As of #400 in v1.0.0-alpha.1, the pod’s name matches the module name, so the umbrella header should no longer be broken. What’s more, this library no longer supports Objective-C, so the umbrella header likely has even less relevance.

Please check again whether the issue persists in v1.0.0-alpha.1.

@1ec5 1ec5 added the build label Jan 12, 2020
@1ec5 1ec5 added the needs more information Can't proceed without more data. label Jan 12, 2020
@dwieners
Copy link

dwieners commented Mar 2, 2020

Hey there, I have some issues since iOS 13.3.1 with use_frameworks!.
https://forums.developer.apple.com/thread/128435
Is there any way to fix that issue? Unfortunately I can't load MapboxDirections/MapboxDirections.hby adding :modular_headers => true to my Podfile

@1ec5
Copy link
Contributor

1ec5 commented Mar 3, 2020

Hey there, I have some issues since iOS 13.3.1 with use_frameworks!.
https://forums.developer.apple.com/thread/128435

That’s mapbox/mapbox-gl-native-ios#157, unrelated to the problem that was tracked in this issue.

@1ec5
Copy link
Contributor

1ec5 commented Mar 3, 2020

This library no longer supports Objective-C code directly. See #381 for background and a workaround if your application is still written in Objective-C.

@1ec5 1ec5 closed this as completed Mar 3, 2020
@1ec5
Copy link
Contributor

1ec5 commented Mar 3, 2020

My bad, I thought the original issue was about importing the umbrella header manually, as one would in Objective-C. Still, I think the root cause mentioned in #318 (comment) is resolved as of v1.0.0-alpha.1, since we’ve removed “.swift” from the pod’s name.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build needs more information Can't proceed without more data.
Projects
None yet
Development

No branches or pull requests

6 participants