Can't integrate localytics-react-native on iOS - ios

I'm trying to integrate the localytics-react-native package to my already existing app and successfully integrated it on android but I can't pass the build phase on iOS.
I followed this documentation to do so.
After linking it manually, I followed every step on the localytics documentation.
On the second step 2. Add dependency, the libLLLocalytics.a is already in the Linked Frameworks and Libraries section so I skipped this step.
I managed to go trought every step without problem but at the end it doesn't build and I get this error :
We are managing our natives librairies with cocoapods and and it's the first librairie I have to install without it. Is there a specific configuration I have to do to support the two way of managing them ?
I also tried to follow the iOS specific documentation and install the library with pods. It builds but on the JS side when I try to import LLLocalytics, it returns me undefined.
Versions :
react-native: 0.57.7
react: 16.6.3
localytics-react-native: 2.3.1
pod --version : 1.4.0
If anybody can help me, I thank you in advance.

In Xcode, go to [target] -> Build Settings -> Search Paths -> Header Search Paths and add the directory where the dependency is located. The linker just doesn't know where to find the header yet.

Related

Xcode Cloud No such Module Cocoapods library

I have a project using a Cocoapods as dependency manager and I am trying to create an Xcode Cloud workflow for it, everything look simple to configure and I added the ci_post_clone.sh to run the pod install command before start building.
Based on the logs all the dependencies are downloaded but whenever it starts building I have the No such Module X error, I am not sure what i did wrong but it looks like xcode Cloud misses the step of Building targets in dependency order and it starts building the main project before building the dependencies
Did anyone face this problem and how did you fix it
Thank you for your help
I found a temporary solution by adding the pod folder to my repository, this is not what most people are willing to do but for now it is working
do you have a screenshot for how you set this up? Because the script file ci_post_clone.sh needs to exist in a repository named ci_scripts that is at the same level as your workspace / xcode project. You also need to be sure to mark that file as executable
then you can brew install cocoapods and run pod install on that script. cheers! just got this working this morning by following notes found here: https://developer.apple.com/documentation/xcode/making-dependencies-available-to-xcode-cloud

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!

PLCrashReporter frameworks integration produce "Could not inspect the application package." error

I am actually trying to integrate PLCrashReport using either a Framework (the one given on the official website) or Carthage.
Carthage won't compile the framework, and the manual drag & drop with the one downloaded from the website would produce the following error when installing the app on the device (Run build)
App installation failed
Could not inspect the application package.
I use a build target of iOS8, I linked the framework as an embedded binary to ship it with the app ; and this error is very annoying.
Xcode is in 7.3
Right now, I tried manual build for the framework, clean of the project. None would work.
By curiosity, I tried Cocoapod integration for this library, it worked, but Cocoapod is NOT an option on my project so I can't go with it.
Does anyone have had the same issue, any ideas for correcting it ?
Finally found a way to make it work :
PLCrashReporter should NOT be in embedded frameworks, just in linked frameworks. Works like a charm now, debug and release builds !

How do I use SwiftyJSON in my iOS App?

I recently added SwiftyJSON into my xCode project using Carthage.
Cartfile
$ cat Cartfile
github "SwiftyJSON/SwiftyJSON" >= 2.1.2
I ran this command to install SwiftyJSON
$ carthage update
I added the built Framework to my xCode project
I imported the Framework at the top of my project
But I still get this error:
Use of unresolved identifier 'JSON'
Seriously, what am I doing wrong? I'm new to iOS development.
UPDATE: I tried removing the Frameworks and re-dragging the frameworks to the Linked Frameworks and Libraries and Adding the "Run Script" section to "Build Phases" as the instructions in Carthage asked.
I'm convinced that something went awry during the Carthage Update process because I received this error on my initial attempt:
$ carthage update
*** Fetching SwiftyJSON
*** Fetching Alamofire
*** Checking out SwiftyJSON at "2.1.3"
*** Checking out Alamofire at "1.1.4"
*** xcodebuild output can be found in /var/folders/0x/swzt630n3_575tglljpwhn4h0000gn/T/carthage-xcodebuild.Pc6rLg.log
*** Building scheme "Alamofire iOS" in Alamofire.xcworkspace
*** Building scheme "Alamofire OSX" in Alamofire.xcworkspace
*** Building scheme "SwiftyJSON" in SwiftyJSON.xcworkspace
** BUILD FAILED **
The following build commands failed:
Check dependencies
(1 failure)
After looking up the problem, I was told that you could run
carthage update --configuration Debug
Which installed it fine, but something is still amiss...
It seems like you missed a step during the addition of SwiftyJSON and Alamofire frameworks from Carthage. Check out these steps from the Carthage readme page :
Steps :
Create a Cartfile that lists the frameworks you’d like to use in your project.
Run carthage update. This will fetch dependencies into a Carthage/Checkouts folder, then build each one.
On your application targets’ “General” settings tab, in the “Linked Frameworks and Libraries” section, drag and drop each framework you want to use from the Carthage/Build folder on disk.
On your application targets’ “Build Phases” settings tab, click the “+” icon and choose “New Run Script Phase”. Create a Run Script with the following contents:
/usr/local/bin/carthage copy-frameworks
and add the paths to the frameworks you want to use under “Input Files”, e.g.:
$(SRCROOT)/Carthage/Build/iOS/Alamofire.framework
$(SRCROOT)/Carthage/Build/iOS/SwiftyJSON.framework
Looks like you missed step 4. I tried these steps myself in a demo Swift project and they are working great. Try these steps out, and if you still have problems, leave a comment. Thanks!
I switched over to Cocoapods and it just worked. Again, I'm a total noob when it comes to iOS development. When looking for a dependency manger I looked at Cocoapods and Carthage for what they had to offer. I was intrigued by Carthage's claim of keeping things simple:
"Carthage because we wanted the simplest tool possible—a dependency manager that gets the job done without taking over the responsibility of Xcode"
While I always will choose the simpler tool when given a choice, I think I don't know enough of the iOS ecosystem (read: Xcode) to use Carthage.
TL,DR: Can't use it inside of Emulator, Use iPhone.
I also followed your way, and I found out that --configuration debug will code-sign "iOS Developer" identity as SwiftyJSON's project property.
AFAIK, Code-signed "iOS Developer" identity wasn't run with Emulator.
My issue was resolved when I run it at my iPhone 6.
I do not know why you can not add this resource with help of Carthage but if you need use SwiftyJSON you only need:
Enter this URL: SwiftyJSON
Clic the button "Clone or download" and then in "Download ZIP" like the next image shows:
Clic the button "Clone or download" and then in "Download ZIP" IMG
You will get a ZIP file with name "SwiftyJSON-master"
Extract the files
Enter the path:
SwiftyJSON-master/Source/
You will see a file with name:
SwiftyJSON.swift
Copy that file into the files of your project.
Add that file into your project directory.
That file will be like other class into your project that you may use.

SoundCloud iOS SDK architectures

Im working on a music streaming iOS project and want to leverage the SoundCloud SDK.
I followed this guide to the tee:
https://developers.soundcloud.com/docs/api/ios-quickstart
The five SoundCloud dependencies are:
CocoaSoundCloudAPI
OAuth2Client
JSONKit
OHAttributedLabel
CocoaSoundCloudUI
All five of these projects are available as submodules that you simply add to your current git repository. According to the guide linked above, you are supposed to be able to add them and move on with your project. However, their architectures are all different! CocoaSOundCloudAPI, JSONKit, OHAttributedLabel and CocoaSoundCloudUI are all 32bit architecture projects, while OAuth2Client is a 64bit architecture project.
No matter what I build my project as, 32 or 64bit, I get a Mach-O linker error. I've added both 32bit and 64bit as Valid Architectures in my main Xcode Project, but the issue persists.
I have also not been able to find other versions of these submodules. I can't be the only one with this problem, as I have literally followed the guide word by word, yet I can't find any solution anywhere.
Please help me out!
I am using Xcode 6 and building for the iOS8 SDK.
Thanks!
Edit:
Here are screenshots of my architectures and the error...
I HIGHLY suggest using CocoaPods to manage this dependency. I once integrated SoundCloud into a project without using CocoaPods and it was a pain in the rear. Look at this link and do a search for CocoaPods to see how to install it: https://github.com/soundcloud/CocoaSoundCloudAPI
Here's something that helped me:
Go to the SmartSpeakers target (or whichever is the target for your app)
Build Settings -> Other Linker Flags
Add $(inherited)
Build it!
CocoaPods was the way to go for me. My Podfile looks like this:
pod 'CocoaSoundCloudAPI', '1.0.1'
pod 'CocoaSoundCloudUI', '1.0.5'
pod 'JSONKit', :podspec => 'https://gist.github.com/marcdown/5282955/raw/2a52cfd92f112f2a52669420c82c1bb1efd15d2a/JSONKit.podspec'
As of the time of this post, the podspec fetches version 1.6.0. I experienced problems with some deprecation issues in earlier versions of JSONKit. If one leaves out the pod for JSONKit, an earlier version that contains these issues is installed by Cocoapods.
I also had to disable ARC for the JSONKit pod in its Build Settings to silence ARC errors:
Pods-JSONKit -> Build Settings -> Apple LLVM 6.0 - Language - Objective C
This did it for me.
Are you trying to deploy to a 64-bit device? Try setting Build Active Architecture Only to NO under Targets -> Your App -> Build Settings -> Architectures.
EDIT: I followed the instructions and created a sample project that builds. I couldn't figure out exactly why you were getting that linker error, but maybe you can compare my project to yours.
http://lieberman.nyc/sample_soundcloud_project_for_relatively_slow_on_stackoverflow.zip

Resources