MuPDF Cocoapods Installation Error - ios

After researching on what library to use in one of my projects for epub reader, I decided to use MuPDF. I integrated it using Cocoapods, but when I build the app, it gives me a couple of errors on _math.h_ file on lines 36 and 73. I have attached the screenshots for reference. It would be of great help if anyone here can help me build the app after integrating MuPDF without any error. line 36

I think you are being hit by a not-backwards-compatible change that took place in CocoaPods 0.39 ( https://github.com/CocoaPods/CocoaPods/pull/4057 ).
Can you upgrade your CocoaPod to 0.39? (gem update cocoa pods) If you do so and then run pod install that should fix it.
If you can't upgrade to 0.39, you could use the 1.7 podspec mupdf, which is compatible with CocoaPod 0.38.
There's an example project that uses the MuPDF pod spec here:
https://github.com/jogu/MuPDF-example
(To try and prevent this problem in the future I just pushed a new pod, 1.8.2, that has a cocoapods_version >= 0.39 restriction in the podspec.)

Related

libPhonenumber (from Google) on iOS in a Kotlin Native project

I've been struggling to solve a problem.
I'm building a cross platform app (iOS and Android) using Kotlin Multiplatform (KMP) where I need a library from Google (https://github.com/google/libphonenumber).
For Android, I can point to a Maven repo (https://repo1.maven.org/maven2/com/googlecode/libphonenumber/libphonenumber/8.12.6/).
For iOS, I can use a ObjC port of libPhonenumber via Cocoapods.(https://cocoapods.org/pods/libPhoneNumber-ios).
But, I can't use Kotlin's (cocoapod plugin) to properly recognize the Pod. The plugin appears to fail to build.
Here's the details of my setup:
Xcode v11.5
IntelliJ IDEA v2020.1.2
Cocoapods v1.9.1
Gradle 6.0.1
Sample repo (https://github.com/touchlab/kotlin-native)
NOTE: Within the repo, I'm using ./samples/cocoapods
modify ./samples/cocoapods/kotlin-library/build.gradle.kts
commented out AFNetworking, remove AFNetworking pod
pod("AFNetworking", "~> 3.2.0")
add a new pod
pod("libPhoneNumber-iOS")
modify ./samples/cocoapods/kotlin-library/gradle.properties
change this line:
kotlin.native.home=../../../dist
to this:
#kotlin.native.home=../../../dist
in Terminal in this folder: ./samples/cocoapods/kotlin-library/
./gradlew podspec
This creates a podspec file (libPhoneNumber-iOS.def) in ./samples/cocoapods/kotlin-library/build/cocoapods/defs/
cd from kotlin-library to ios-app folder
cd ../ios-app/
Pod install using the command:
pod install
You'll see something like:
Downloading dependencies
Installing kotlin_library (1.0)
Installing libPhoneNumber-iOS (0.9.15)
Generating Pods project
Integrating client project
Pod installation complete! There is 1 dependency from the Podfile and 2 total pods installed.
When I build the sample 'ios-app' target: simulator in Xcode, I get the error:
fatal error: module 'libPhoneNumber' not found
I have tried other libPhoneNumber pods, such as:
libPhoneNumberSwift
LTPhoneNumberField
Both fail to build using Kotlin's cocoapods plugin, but work as a Pod without Kotlin's cocoapod plugin.
What am I missing?
This particular problem seems to be caused by the dash in the pod's name. There was already an issue reported on GitHub. For now, it's recommended to workaround this problem by re-naming the module. Changing your kotlin-library/build.gradle.kts like
pod("libPhoneNumber-iOS", moduleName = "libPhoneNumber_iOS")
should help. Please give it a try and tell here or on GH if it works.
I have obtained excellent results by adding the unchanged Javascript version of libphonenumber using JavaScriptCore in IOS. The only part of the library not available yet in Javascript is the geocoder.
I used the concept explained here: https://www.appcoda.com/javascriptcore-swift .
Performance is great and there is no porting involved. Always the latest version available.

Upgrade JS only react-native library to RN 0.60

I have a react-native component library, which only contains javascript code. I don't have ios/android directory (in library). I want to make it compatible with react-native 0.60. My library has some dependencies which which needs linking. Until this point I was just asking consumers to link these dependencies manually.
Now for autolinking (in RN 0.60) to work, I will need to a podspec for my project. But I don't really have any ios code (or directory) in my library. So I can't create podspec. So in this case, only way I can see is to ask consumers of my library to manually install all the NPM dependencies of my libraries and then pod install. Is there some other way that I can configure it in my library, that will let cocoapods know to install the dependencies of my library as well?
P.S. I am not really much familiar with ios or cocoapods. So if this question sounds a bit silly, please pardon me.
You can try to run following command to generate ios/android directories:
react-native upgrade --legacy true
Then you can run following command to install iOS dependencies when the directories generated:
cd ios
pod install
I don't think this is possible at least with version 0.60, Because of breaking changes in this version, If you are on the version before 0.60 and wanted to upgrade on 0.60 you have to face native issues and breaking changes in the native libraries as well because for now most of the libraries have two different versions one for above 0.60 and other for below 0.60.
When you will try to upgrade on 0.60 this version also have native changes and also auto linking is been introduced so some native libraries can also cause problem due to this.
My Recommendation is to use Upgrade helper tool and get an idea about the changes that you need on every version.
https://facebook.github.io/react-native/docs/upgrading

Xcode showing error 'No such module' even though I've installed Cocoapods and installed pod file of Dialogflow

I've been making a chatbot using Dialogflow formerly Api.AI but now encountering error while integrating the project to my app written in Swift in Xcode. I'd installed cocoapods using terminal "sudo gem install cocoapods" and using this version of Dialogflow to create the podfile.
All gone well but now when I'm importing inside Xcode in my app's AppDelegate.swift file using import ApiAI or import AI Xcode is showing me error that No such module. Please refer to image.
And on GitHub this library which is written in Swift, showing that it has depreciated and asking me to refer to API.AI's Apple Client library which is in Obj-C and unfortunately I've no expertise in Obj-C.
After installing a pod using Cocoa Pods, you must from that point forward open the workspace rather that the project file. The icons will appear differently in your project like so:
In the image you provided is clearly showing that you have opened the project file not the workspace one.
Go to Pods Build settings and set Build Active Architecture Only to NO. This always helps while using pods. After that clean the project once and then build.
After installing pod you should clean project (shift + command + k) and then builds (command + b) in it a few times. Repeat it a few times if it is not still working.
Hope this help!

How to install a development Framework in MacOS for commandline build

I have an iOS application that needs to be integrated into CI/CD pipeline in CircleCI. Most of my dependencies have been added using CocoPods. There is one particular dependency of OpenCV2 that is manually compiled and used. On the local development machine, It is simple to use with drag & drop in Xcode. But, while running the build on a CI server. We don't have access to GUI and need to link dependency from the command line. I have not found much of the resources dealing with this issue.
I have tried few options from this link
https://developer.apple.com/library/content/documentation/MacOSX/Conceptual/BPFrameworks/Tasks/InstallingFrameworks.html
The framework that I am trying to use is compiled and zipped in an archive (opencv2.framework.zip and uploaded on Amazon S3. It is because the compiled framework is about 300 MB in size. So, I can't push it to the source repository. So, I download it using curl and unzip on CI machine. I have tried unzipping it to
/System/Library/Frameworks
/Library/Frameworks
~/Library/Frameworks
gym --scheme "project" --workspace "project.xcworkspace"
None of them really worked.I would like a way to register this framework in the system so that linker can find it while linking.
Suggest a way to extract framework into a location which linker can automatically look into.
Suggest a way where I can link framework manually from command line build
I have never used OpenCV but a quick pod search gives this result, so looks like they are already supporting cocoapods.....
pod search opencv
-> OpenCV2 (3.2.0)
OpenCV (Computer Vision) for iOS.
pod 'OpenCV2', '~> 3.2.0'
- Homepage: http://opencv.org
- Source: http://github.com/bcomeau/opencv/releases/download/3.2.0/opencv-3.2.0-ios-framework.zip
- Versions: 3.2.0 [master repo]
Second:
You can use Carthage https://github.com/Carthage/Carthage
You can use both Cocoapods and Carthage at the same time as long as they are not downloading the same dependencies.
Create a private repo, follow the carthage tutorial for uploading frameworks https://github.com/Carthage/Carthage#supporting-carthage-for-your-framework
then put opencv2 to your repo.
Then add your repo to your cartfile
Then before or after you install cocoapods, install carthage frameworks too.
It is a bit work but can solve your problem.
Third:
Looks like they also support Carthage
https://github.com/card-io/card.io-iOS-source/issues/32
Look at the last couple of comments..

What is causing Cocoapods/RedditKit to not work with version 0.39?

I've updated to version 0.39 of Cocoapods per the persistent recommendation in the terminal, and I'm using RedditKit, an Objective-C wrapper for the Reddit API in an app I'm playing around with.
It's installed through Cocoapods, and I've never had an issue, but since updating to Cocoapods version 0.39 it will not compile any longer, even in a small sample project such as what's included with the repo.
I keep getting "RKClient.h not found" as the compile error, but the file is very clearly there in the Pods folder - I can command-click it!
Was there a big change in 0.39 of Cocoapods that stops it from recognizing files that it would previously? A syntactical issue in my Podfile? How would I fix this to allow the project to compile? (Note, I cannot just revert Cocoapods to a previous version unfortunately.)

Resources