"Use of undeclared identifier 'Braintree'" error after manual Braintree integration without using CocoaPods - ios

I am getting the following error when calling [Braintree braintreeWithClientToken.
ViewController.m:21:27: Use of undeclared identifier 'Braintree'
I followed the Manual Integration Without CocoaPods guide to add Braintree to a new Objective-C project.
Solution - building Braintree.framework
I have managed to build a Braintree.framework that can easily be used in iOS apps, Objective-C or Swift.
Instructions are there:
https://github.com/exchangegroup/braintree-framework-builder

Here's a PR which fixes this error in your Demo: https://github.com/exchangegroup/brain-tree-manual-setup-error-four/pull/1
Here's a PR which fixes this error in your newer Demo: https://github.com/exchangegroup/braintree-manul-setup-ten/pull/1
Unfortunately, the #import statements using <angled> includes had to be replaced with "quotes" instead. While non-ideal, this was a straightforward operation by using a find-and-replace regex: <Braintree/(.*)> -> "$1"
If you're doing a new integration, Braintree recommends using CocoaPods instead. Let us know if there's a reason CocoaPods won't work for your use case.
Hope this helps :)

Related

Build error in ionic capacitor iOS app ‘Firebase.h’ not found

I'm new to cross platform and mobile dev in general. I am using ionic6 with Angular and Capacitor3.
I am trying to make an app that uses push notifications (with Firebase). I had managed to compile my iOS app once, but on my 2nd attempt it didn't work although I hadn't changed anything.
I have followed this documentation
https://capacitorjs.com/docs/guides/push-notifications-firebase
As well as this tutorial (I've copied the code from the doc as the tutorial is a little old)
https://devdactic.com/push-notifications-ionic-capacitor/
When I build my app, i get this error :
/Users/usr/Documents/my-app/ios/capacitor-cordova-ios-plugins/sources/CordovaPluginFcmWithDependecyUpdated/FCMPlugin.m:8:9: 'Firebase.h' file not found with include; use "quotes" instead"
If I change #import <Firebase.h> into #import "Firebase.h" as suggested, then I get his error :
/Users/usr/Documents/my-app/ios/capacitor-cordova-ios-plugins/sources/CordovaPluginFcmWithDependecyUpdated/AppDelegate+FCMPlugin.m:215:7: Use of undeclared identifier 'FIRInstanceID'
FIRInstanceID_error_image
I read somewhere that I only need to comment it since it's deprecated. Which leads me to this error :
Undefined symbol: OBJC_CLASS$_FIRAnalytics
FIRAnalytics_error_image
I've tried almost everything I could find online but nothing works. I've been stuck here for a week now.
Please let me know if you have any leads or if you need more information (preferably how to get it since I'm still new to this, I may not know how to)
Thank you very much in advance !

Convert to Current Swift Syntax Failed - "No such module" (Swift 4, Xcode 9)

In Xcode 9, I am trying to do the automatic conversion to Swift 4.
It fails with the following message:
Convert to Current Swift Syntax Failed
Please ensure that all selected targets build successfully with the currently configured Swift version before attempting a migration.
It's complaining of a missing module. But when I do a regular build there are no issues. Not sure if this is relevant, but the module (which Xcode is complaining is missing) was already converted to Swift 4 earlier (in it's own project).
Note: No Cocoapods / Carthage used here.
Note: Two solutions tried (and worked) but do not address the underlying issue.
One solution is to do the conversion manually (change Swift version to 4 in build setting and apply Fix-Its one by one until no more build errors).
Another solution is to disable the third party framework (comment out all code where it's used), do the auto-migration, and then re-enable the framework. This could get pretty difficult with bigger projects.
I can't find any solution yet.
For now I fix manually setting Swift Language Version
After changing from 3.2 to 4.0 I compile and fix errors and warnings manually.
I'm waiting for a better solution!
I also got this problem while converting my project to Swift 4.0. Looks like problem appears when you try to convert target which imports a framework which is already in Swift 4.0. At your screenshot you try to convert 'RecipeTextParser' which imports 'SovaTools' which is already Swift 4.0.
I found dirty, but working solution. You can use older(Swift 3.2) version of 'SovaTools' when converting. You should NOT check it's mark in target selection window of conversion tool. Then, when 'RecipeTextParser' will be successfully converted you can use Swift 4.0 'SovaTools' version again.
I got this error and in my case one of my Pods(the one Xcode was complaining about) was a Swift 4 target and the rest were Swift 3.2. Looking at the build logs it looks like Xcode built that framework in one location and was searching for it in another. When I reverted that Pod to an older version(that used Swift3.2) the problem went away. Obviously a Xcode bug. HTH
Just update your pod and it will resolve the issue.
To update pod:
open terminal and go to your project directory
type pod update
This resolved my issue.
Xcode (Xcode 9) language migration feature is not as much accurate that it can migrate your complete code/project from one swift version to another with zero tolerance. It skips few code migration for us (developers). It may be bug or inaccuracy of tool. But you need to put some manual effort also, to completely migrate swift language version for your project/code.
Now, according to your snapshot, Xcode is showing and error for 'RecipeTextParser' framework. I think this is an external/third party framework. Another point to note, you've integrated this framework using CocoaPods:
Any one of following can be reason for failure of code migration:
CocoaPods locks framework (files) for editing. So language migration process may not be able to migrate (or identify) code for external/thirdparty framework.
In general terms, Framework is package of code files, so framework itself may not allow file/source code editing.
Suggestion as solution:
Update your cocoa pods as well as all frameworks integrated using cocoa pods compatible to latest swift language version.
If you've manually integrated/added external/third party frameworks, then you need to update/replace those also.
Some manual effort is required to completely migrate code between swift languages. I tried swift migration with above options and my all projects are now compatible with swift 4.

Use of undeclared type 'KIFTestActor'

I've a code example project, https://github.com/tutsplus/UIAutomation-Jumblify.git, that I've been trying to add automated tests (for practicing purpose since I'm new to the iOS Automation world), and I've followed the instructions on the README, and when I build, I'm getting this error:
This is the project structure, in which you'll find the header file
Is there any other configuration that I need to do? I've followed the CocoaPods steps, can the above project and my swift UI Test live together?
As I said, I'm a newbie to Swift and automation on IOS!
Please help!
Thanks!!!
Well I was missing the 'Objective-C Bridging Header '

Why do I get a lot of errors while adding Alamofire framework?

I try to add Alamofire framework for IOS using cocoapods and adding it directly to the project. I get a lot of compiler errors in both cases though I follow all the guides.
Perhaps somebody can help me?
What version of Xcode and Alamofire are you using?
I can see an error there for Do-While which was removed in Swift 2.0
I guess you need to Upgrade to Xcode 7. Then follow again the steps from Alamofire Readme Page on Github.
I personally prefer CocoaPod to add frameworks.

sharekit for cordova 2.2.0

I am new to iOS development with phonegap,
im trying to use the sharekit plugin, i followed all the steps mentioned in the Readme (sharekit 2.0), but it is still not working, I have receive following 3 errors:
/..path../Plugins/ShareKitPlugin.m:31:63: Use of undeclared identifier 'SHKURLContentTypeWebpage'
/..path../Plugins/ShareKitPlugin.m:85:63: Use of undeclared identifier 'SHKURLContentTypeWebpage'
/..path../Plugins/ShareKitPlugin.m:102:63: Use of undeclared identifier 'SHKURLContentTypeWebpage'
The problem is that i can't find any sharekit working properly for cordova 2.2.0, as I conclude that the old version of this plugins doesn't support the new cordova 2.2.0.
any suggestion to get the latest plugin? or How to fix these errors?
I had the same problem using phonegap 2.7.0 and the latest sharekit and sharekitplugin from the repo. Add this line below the import statement. It compiles and the plugin works for me. I don't know for sure if this is right though.
#import "SHKMail.h"// Add below this statement
char *SHKURLContentTypeWebpage="text/html";
The plugin has not been updated for 2 years so this is probably an incompatibility with the new Sharekit.
Did not get these errors myself. But just a quick tip. Did you follow the wiki? Don't forget the first step, as downloading the plugin directly from the Github page doesn't include the submodules.

Resources