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

ios-metadata-generator not picking up the Moodstocks Cocoapods library #1192

Closed
mattvot opened this issue Dec 1, 2015 · 4 comments
Closed

Comments

@mattvot
Copy link

mattvot commented Dec 1, 2015

After seeing NativeScript at AngularConnect recently, I've been able to set aside a week to investigate how we can use it.

I am trying to get the Moodstocks iOS SDK working with NativeScript to bring image recognition into NS.

We believe the ios-metadata-generator is either not parsing the header files correctly or there is something that the library needs to. In both cases, it is frustrating that I cannot find any documentation relating to this issue.

Moodstocks is not an open-source project and is distributed as a .framework with a binary file and headers. With no practical knowledge of how native projects usually work, I have been discussing this with some native developers in our team to try and figure this out. This is what we have found:

Reproduction

  1. We created a brand new iOS NativeScript project.
#shell
tns create ir && cd ir && tns platform add ios
  1. Added these cocoapods:
#file ir/platform/ios/Podfile
platform :ios, '8.0'
use_frameworks!
pod 'AFNetworking'
pod 'Moodstocks-iOS-SDK', '~> 4.0'

#shell
pod install
  1. Update app.js
#file: ir/app/app.js
catcher(function(){
    console.log(AFURLConnectionOperation);
});

catcher(function(){
    console.log(require("AFURLConnectionOperation"));
});

catcher(function(){
     // objc! syntax suggested in https://github.com/NativeScript/sample-iOS-StaticLibs/blob/master/README.md#add-module-map
    console.log(require("objc!AFURLConnectionOperation"));
});

catcher(function(){
      console.log(MSScanner);
});

catcher(function(){
      console.log(require("MSScanner"));
});

catcher(function(){
    // objc! syntax suggested in https://github.com/NativeScript/sample-iOS-StaticLibs/blob/master/README.md#add-module-map
    console.log(require("objc!MSScanner"));
});

function catcher(callback)
{
    try
    {
        callback()
    }
    catch(e)
    {
        console.log(e);
    }
}

var application = require("application");
application.mainModule = "main-page";
application.cssFile = "./app.css";
application.start();
  1. Run emulation
#shell
tns run ios --emulator --device "iPhone 6"

Using tns version 1.5.0

The only statement that resolves without error is console.log(AFURLConnectionOperation);

I think this means that Moodstocks has not been picked up by the generator, whereas AFNetworking is.

We speculate it may have something to do with the structure of the frameworks. But this is pure speculation:
screen shot 2015-12-01 at 15 05 33

Any advice would be welcome, and we vastly appreciate the work so far! It would be good to have a document explaining how the ios-metadata-generator works, as android does.

@mattvot mattvot changed the title Moodstocks SDK support issue with ios-metadata-generator ios-metadata-generator not picking up the Moodstocks Cocoapods library Dec 1, 2015
@N3ll
Copy link
Contributor

N3ll commented Dec 1, 2015

Hey @mattvot, we will investigate the problem with the CocoaPods and we will get back to you as soon as we have something.

You can find Information about the metadata generators in their GitHub repositories - ios and android.

@ivanbuhov
Copy link
Contributor

Hi @mattvot,
I turns out that Moodstocks framework doesn't contain Modules/module.modulemap file which is needed for metadata generation process. To add the file manualy go to {your-app}/platforms/ios/Pods/Moodstocks-iOS-SDK/moodstocks-ios-sdk-4.1.6/Moodstocks.framework/, create Modules folder and create module.modulemap file in it with the following content:

framework module Moodstocks {
  umbrella header "Moodstocks.h"

  export *
  module * { export * }
}

This will do the trick, but the solution requires a manual changes in the platforms/ folder which is not recommended. Alternatively, I suggest wrapping the Modstocks framework in NativeScript plugin and using the plugin in your app. This way the module.modulemap file will be added only once in the plugin.

@mattvot
Copy link
Author

mattvot commented Dec 1, 2015

Ah ha! Thanks @ivanbuhov. It works now after manually adding the module.modulemap.

If I have time in the future, I may start add some documentation relating to the module.modulemap.

I will also be contacting Moodstocks to see if they can add it to their framework as well.

@lock
Copy link

lock bot commented Aug 30, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked and limited conversation to collaborators Aug 30, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants