View Full Version : Adding Skobbler to a swoft framework (instead of an app)

12.11.2015, 19:04
We're evaluating skobbler for a large deployment.

I'm building a framework that will be included in one or more apps.

I followed the steps to add in the documentation to add the cocoapod to my framework, but the framework doesn't build. It can't import SKMaps. I had to make two changes to make it work:
1. Add "${PODS_ROOT}/ScoutMaps-iOS-SDK/SKMaps.framework/Headers" to my Header Search Paths
2. Manually create module.modulemap in "${PODS_ROOT}/ScoutMaps-iOS-SDK/SKMaps.framework/Headers"

Content of module.modulemap

module SKMaps {
header "SKMaps.h"
export *

These two changes got me building successfully, but now I need to create a private cocoapod for my own framework. I'm hitting the same errors again.

From what I have been able to determine, https://developer.apple.com/library/ios/documentation/Swift/Conceptual/BuildingCocoaApps/MixandMatch.html describes what you need to do to package an Objective-C cocoapod so it can be used inside other Swift frameworks. See the section titled "Importing Code from Within the Same Framework Target"

In the meantime, I suppose I'll have to hack a fix in the podspec for my cocoapod, and find a way to make it work with the ScoutMaps-iOS-SDK cocoapod. I'm not sure yet how I'll do that.

To reproduce my problem:
1. Create a new swift iOS framework project.
a. File | New | Project.
b. In the left panel under iOS, select Framework & Library.
c. In the right panel, select CocoaTouch Framework. Next.
d. Enter project name, SkobblerNestedFramework. Make sure to select Swift for the language. Next.
e. Choose location for project. Create.

2. Create Podfile:

platform :ios, '9.0'

target 'SkobblerNestedFramework' do
pod 'ScoutMaps-iOS-SDK'

target 'SkobblerNestedFrameworkTests' do
pod 'ScoutMaps-iOS-SDK'

3. Pod Install
4. Create a class that uses SKMapView

import UIKit
import SKMaps

public class SkobblerMapView: UIView {

var mapView: SKMapView

public override init(frame: CGRect) {
mapView = SKMapView(frame: CGRectMake(0,0, frame.size.width, frame.size.width))
super.init(frame: frame)

required public init?(coder aDecoder: NSCoder) {
mapView = SKMapView(frame: CGRectZero)
super.init(coder: aDecoder)

public override func awakeFromNib() {
mapView.frame = self.bounds

According to the Apple documentation, the "import SKMaps" should not be necessary. Removing it results in errors on every line that references mapView.

I tried to attach a zip file with a sample project created with the steps above, but I would not upload, probably due to size (94 MB).

Does anyone have suggestions about how to work around this problem so that my cocoapod, with its dependency on the ScoutMaps-iOS-SDK cocoapod will work? (pod lib lint fails because it can't find SKMaps).


13.11.2015, 14:38
Iíll forward this request to our developers. I'll get back with an update

13.11.2015, 17:31
For what it is worth, I backed out these two changes in my Xcode project:

1. Add "${PODS_ROOT}/ScoutMaps-iOS-SDK/SKMaps.framework/Headers" to my Header Search Paths
2. Manually create module.modulemap in "${PODS_ROOT}/ScoutMaps-iOS-SDK/SKMaps.framework/Headers"

So, I removed "${PODS_ROOT}/ScoutMaps-iOS-SDK/SKMaps.framework/Headers" from my Header Search Paths, and
Deleted module.modulemap that I had created in in "${PODS_ROOT}/ScoutMaps-iOS-SDK/SKMaps.framework/Headers"

I replaced these with a build run script that copies the headers, and adds the module.modulemap file to the new header location. This way I don't have to remember to re create the module.modulemap file whenever I update the ScoutMaps-iOS-SDK cocoapod.

mkdir -p "${PODS_ROOT}/Headers/Public/SKMaps"
cp -f "${PODS_ROOT}"/ScoutMaps-iOS-SDK/SKMaps.framework/Versions/A/Headers/${FILES_TO_COPY} "${HEADER_DIR}"
echo "module SKMaps {" > "${HEADER_DIR}"/module.modulemap
echo " header \"SKMaps.h\"" >> "${HEADER_DIR}"/module.modulemap
echo " export *" >> "${HEADER_DIR}"/module.modulemap
echo "}" >> "${HEADER_DIR}"/module.modulemap

This keeps my Xcode build working, but still don't have a way to create my own podspec that will validate correctly with pod lib lint.


16.11.2015, 12:33
Thanks for the additional information. I've reported forward.

Update [17-05-2016]:
The issue was fixed and would be included in the next release 3.0