iink SDK on Device

Answered

Integration MyScript iOS framework inside another iOS Swift framework

I am getting Swift Compiler errors when try to build my custom framework in which I am trying to integrate MyScript framework. Attached is the screenshot of the same. I am integrating it as a cocoapod.

I am able to integrate the MyScript framework directly to an iOS swift project, but not into a custom swift framework. 

I have added and checked all the possible dependencies in Build Settings and Build phases of my custom framework.

Below is the pod file content I have,

  

platform :ios, '11.0'

target 'MyFramework' do

  # Comment the next line if you don't want to use dynamic frameworks

  use_frameworks!

  # Pods for MyFramework

  pod 'MyScriptInteractiveInk-UIReferenceImplementation', :path => './'

end

 I am able to run pod install without any issues. I have created my own MyFramework-Bridging-header.h with the following content.

 

#import <iink/IINK.h>
#import <IInkUIReferenceImplementation/IInkUIReferenceImplementation.h>
#import "MyCertificate.h"

 1) Is it possible to integrate MyScript iOS cocoapod into a swift framework which will inturn be used in a Swift project as a pod?

2) If not, what are the alternative ways?

 



Best Answer

Hi Amruthesh,

I was having a similar problem. Not sure why but it may be the "platform" that is the problem. I was not specifying an iOS version so it grabbed the latest. Once I set it to the version used in the example it worked.

Example uses:
platform :ios, '9.1'

You are using: 
platform :ios, '11.0'

Hope that helps.

Bradley



Dear Amruthesh,


thank you for contacting us.


Currently, looking at your screenshot, it appears either the MyScriptInteractiveInk-UIReferenceImplementation was not properly downloaded or properly deployed into the project, resulting in the IINKIPath.h file not properly found.


In the line "pod 'MyScriptInteractiveInk-UIReferenceImplementation', :path => './," ensure the path is properly set, so the MyScriptInteractiveInk-UIReferenceImplementation deploys properly. If not, please ensure you set it properly.


1) Is it possible to integrate MyScript iOS cocoapod into a swift  framework which will inturn be used in a Swift project as a pod?

2) If not, what are the alternative ways?

>>I recommend you try to make it easy: get the MyScriptInteractiveInk-UIReferenceImplementation  from the podspec you provide. Then add the whole into your project.


Best regards,


Olivier


1 person likes this

Hi Oliver, Thanks a lot for the quick reply.

I have the 'IInkUIReferenceImplementation' folder along with 'MyScriptInteractiveInk-UIReferenceImplementation.podspec' from the example projects in the same folder where I have my podfile for my custom framework. so, the pod 'MyScriptInteractiveInk-UIReferenceImplementation', :path => './' is properly pointing to the 'IInkUIReferenceImplementation' folder. How do I verify that this is correct and deployed properly?

>>I recommend you try to make it easy: get the MyScriptInteractiveInk-UIReferenceImplementation  from the podspec you provide. Then add the whole into your project.

Also, by this do you mean that I should add the 'MyScriptInteractiveInk-Runtime' folder present inside the generated Pods/ folder into my project? or Add the 'IInkUIReferenceImplementation' folder present at the project folder level into the project?

Thanks,

Amruthesh C


Dear Amruthesh,


were you able to configure your pod file so that the UIReferenceImplementation is properly loaded into your project?


Then, when you mention your custom swift framework, are you adding other third parties inside of it?


Best regards,


Olivier

Hi Oliver,

No, I am still getting header not found errors for files which are inside include/IInk/graphics and other nested folders.

I also tried adding the 'MyScriptInteractiveInk-UIReferenceImplementation' and the 'MyScriptInteractiveInk-Runtime' folder inside Pods/ also. In this case I am still getting class/import not found issue.

Yes, I am adding other third party cocoa pod libraries inside my custom swift framework.

Thanks,

Amruthesh C

Dear Amruthesh,


when you say : "I also tried adding the 'MyScriptInteractiveInk-UIReferenceImplementation' and  the 'MyScriptInteractiveInk-Runtime' folder inside Pods/ also. In this  case I am still getting class/import not found issue."

=>This error usually occurs when the path is not properly set in the pod file: https://developer-support.myscript.com/support/discussions/topics/16000023775


Try to tune the path, so that you properly download the UIReferenceImplementation and the project can build.


Best regards,


Olivier

Hi Oliver,

Thanks for your reply.

I have set the path correctly in the podfile as 'pod 'MyScriptInteractiveInk-UIReferenceImplementation', :path => './'

Should we place the 'MyScriptInteractiveInk-UIReferenceImplementation' folder in the project folder manually? or will it be downloaded automatically on doing Pod install? 

If its downloaded automatically, then what about its podspec file? Will that also be generated automatically?

If not generated automatically, is it mandatory to add this folder along with its podspec file?

Also, after running pod install, 'MyScriptInteractiveInk-Runtime' folder gets generated under project/Pods/ . Do we need to do anything with this folder?


To attach the 'MyScriptInteractiveInk-UIReferenceImplementation' in to the project do I need to add/change any settings under project>builld settings ?

Thanks,

Amruthesh C



Dear Amruthesh,


wihtout know how you deployed your xcode project, it is difficult to provide with an accurate answer.


On our side, here is the way we proceed (see the documentation too): https://developer.myscript.com/docs/interactive-ink/1.3/ios/fundamentals/get-started/#playing-with-the-get-started-example

-Let's say you want to run the GetStartedSwift sample

-clone the interactive-ink-examples-ios project:

    git clone https://github.com/MyScript/interactive-ink-examples-ios.git

    cd interactive-ink-examples-ios

-cd Examples/GetStartedSwift

-The Podfile will be located into the latter directory. If opening it, you will see the following line: pod 'MyScriptInteractiveInk-UIReferenceImplementation', :path => '../..'

=>This means the UIReferenceImplementation will be deployed into the ../.. directory (At the same level than the "Example" directory)


From this, depending on your project, you shall then adapt your Podfile accordingly, or/and tune your project. This is more an Xcode issue than a MyScript one. You may also find help on tutorials or forums.


Best regards,


Olivier

Hi Oliver,

Thanks for your reply.

The steps for using the example projects are very clear and I am able to run them without any issues using your documentation.

But doing the same on my custom framework is where I am facing the issues as following the same steps is not working. I believe MyScript framework can be integrated into a Swift framework which has other third party libraries.

Will check the forums and do a clean setup again.

Thanks,

Amruthesh C

Answer

Hi Amruthesh,

I was having a similar problem. Not sure why but it may be the "platform" that is the problem. I was not specifying an iOS version so it grabbed the latest. Once I set it to the version used in the example it worked.

Example uses:
platform :ios, '9.1'

You are using: 
platform :ios, '11.0'

Hope that helps.

Bradley