jogboms / flutter_ravepay

Flutter integration for Flutterwave's Rave payment platform
MIT License
61 stars 16 forks source link

Can't get it to work on iOS with Flutter #12

Closed sebasbose closed 6 years ago

sebasbose commented 6 years ago

How can I make RavePay work on iOS? It won't let me build the app because of issues with Swift. Thanks in advance!!

This is the Debug Console output: `Launching lib/main.dart on iPhone X in debug mode... Xcode build done. Failed to build iOS app Error output from Xcode build: ↳ BUILD FAILED Xcode's output: ↳ === BUILD TARGET firebase_database OF PROJECT Pods WITH CONFIGURATION Debug === /Users/sebasbose/Desktop/Voligg/voligg_marketplace/ios/Pods/Headers/Public/flutter_ravepay/FlutterRavepayPlugin.h:1:9: note: while building module 'Flutter' imported from /Users/sebasbose/Desktop/Voligg/voligg_marketplace/ios/Pods/Headers/Public/flutter_ravepay/FlutterRavepayPlugin.h:1:

import <Flutter/Flutter.h>

^

:1:9: note: in file included from :1: #import "Headers/Flutter.h" ^ /Users/sebasbose/Desktop/Voligg/voligg_marketplace/ios/Pods/../.symlinks/flutter/ios/Flutter.framework/Headers/Flutter.h:44:10: note: in file included from /Users/sebasbose/Desktop/Voligg/voligg_marketplace/ios/Pods/../.symlinks/flutter/ios/Flutter.framework/Headers/Flutter.h:44: #include "FlutterAppDelegate.h" ^ /Users/sebasbose/Desktop/Voligg/voligg_marketplace/ios/Pods/../.symlinks/flutter/ios/Flutter.framework/Headers/FlutterAppDelegate.h:11:10: note: in file included from /Users/sebasbose/Desktop/Voligg/voligg_marketplace/ios/Pods/../.symlinks/flutter/ios/Flutter.framework/Headers/FlutterAppDelegate.h:11: #include "FlutterPlugin.h" ^ /Users/sebasbose/Desktop/Voligg/voligg_marketplace/ios/Pods/../.symlinks/flutter/ios/Flutter.framework/Headers/FlutterPlugin.h:100:42: warning: 'UIUserNotificationSettings' is deprecated: first deprecated in iOS 10.0 - Use UserNotifications Framework's UNNotificationSettings didRegisterUserNotificationSettings:(UIUserNotificationSettings*)notificationSettings; ^ /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.0.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIUserNotificationSettings.h:44:12: note: 'UIUserNotificationSettings' has been explicitly marked deprecated here @interface UIUserNotificationSettings : NSObject ^ /Users/sebasbose/Desktop/Voligg/voligg_marketplace/ios/Pods/Headers/Public/flutter_ravepay/FlutterRavepayPlugin.h:1:9: note: while building module 'Flutter' imported from /Users/sebasbose/Desktop/Voligg/voligg_marketplace/ios/Pods/Headers/Public/flutter_ravepay/FlutterRavepayPlugin.h:1: #import ^ :1:9: note: in file included from :1: #import "Headers/Flutter.h" ^ /Users/sebasbose/Desktop/Voligg/voligg_marketplace/ios/Pods/../.symlinks/flutter/ios/Flutter.framework/Headers/Flutter.h:54:10: note: in file included from /Users/sebasbose/Desktop/Voligg/voligg_marketplace/ios/Pods/../.symlinks/flutter/ios/Flutter.framework/Headers/Flutter.h:54: #include "FlutterPluginAppLifeCycleDelegate.h" ^ /Users/sebasbose/Desktop/Voligg/voligg_marketplace/ios/Pods/../.symlinks/flutter/ios/Flutter.framework/Headers/FlutterPluginAppLifeCycleDelegate.h:70:42: warning: 'UIUserNotificationSettings' is deprecated: first deprecated in iOS 10.0 - Use UserNotifications Framework's UNNotificationSettings didRegisterUserNotificationSettings:(UIUserNotificationSettings*)notificationSettings; ^ /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.0.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIUserNotificationSettings.h:44:12: note: 'UIUserNotificationSettings' has been explicitly marked deprecated here @interface UIUserNotificationSettings : NSObject ^ === BUILD TARGET firebase_database OF PROJECT Pods WITH CONFIGURATION Debug === /Users/sebasbose/Developer Tools/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_ravepay-0.2.1/ios/Classes/FlutterRavepayPlugin.m:2:9: fatal error: 'flutter_ravepay/flutter_ravepay-Swift.h' file not found #import ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1 error generated. Could not build the application for the simulator. Error launching application on iPhone X. Exited (sigterm)`
jogboms commented 6 years ago

@sebasbose Did you follow the guide? I know iOS setup is a bit complex, but it will work eventually,

https://developer.flutterwave.com/docs/ios

sebasbose commented 6 years ago

I have followed the steps, the problem is that now the Debug Console and XCode are throwing a bunch of errors regarding RavePay's Swift code.

jogboms commented 6 years ago

@sebasbose Take a look at the example repo and see if you can reproduce. I currently use this in production and the example repo contains the exact code i use.

sebasbose commented 6 years ago

I re-installed everything, followed the steps just as it is in the docs. Every error I got is now gone; nevertheless I'm still getting an error...

The error output: fatal error: lipo: -extract x86_64 specified but fat file: /Users/sebasbose/Desktop/Voligg/voligg_marketplace/build/ios/Debug-iphonesimulator/Runner.app/Frameworks/Rave.framework/Rave does not contain that architecture Failed to extract x86_64 for /Users/sebasbose/Desktop/Voligg/voligg_marketplace/build/ios/Debug-iphonesimulator/Runner.app/Frameworks/Rave.framework/Rave. Running lipo -info: Architectures in the fat file: /Users/sebasbose/Desktop/Voligg/voligg_marketplace/build/ios/Debug-iphonesimulator/Runner.app/Frameworks/Rave.framework/Rave are: armv7 arm64

What am I supposed to do here?

jogboms commented 6 years ago

Okay. This one is new to me. Maybe a quick search on google might prove useful. And like I said if you follow the example repo. It'll eventually work. Setting up on iOS is a bit tricky.

sebasbose commented 6 years ago

I have managed to get it working with the guid, I had to delete everything related to the pod and install it again following the guide. Everything worked so far but I am getting this error when trying to charge a card:

MissingPluginException(No implementation found for method chargeCard on channel ng.i.handikraft/flutter_ravepay)

Any ideas on what's going on?

jogboms commented 6 years ago

@sebasbose I'd ask again, can you follow the example repo? It seems you haven't implemented in your AppDelegate. See https://github.com/jogboms/flutter_ravepay/blob/master/example/ios/Runner/AppDelegate.swift

sebasbose commented 6 years ago

@jogboms I did add an AppDelegate.swift, the problem is that my Flutter project is written in Objective-C; maybe that's the problem...?

import UIKit
import Rave

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {

    var window: UIWindow?

    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {

        let config = RavePayConfig.sharedConfig()
        config.publicKey = "KEY"
        config.secretKey = "KEY"

        config.isStaging = true // Default is true
        return true

    }
}
jogboms commented 6 years ago

Oh @sebasbose. That could be it. I had issues then too.

I had to result to using Swift.

I even created an issue https://github.com/Flutterwave/Rave/issues/1

sebasbose commented 6 years ago

@jogboms Yeah, I think that's the conclusion... it is incompatible with Obj-C.... isn't there a way to implement Swift into Obj-C?? I am new to Obj-C, I've only developed with Swift, Java, and Dart; never with Obj-C...

jogboms commented 6 years ago

Yeah. I couldn't too at that point so I just stuck with swift.

sebasbose commented 6 years ago

Well, I think I'll have to wait until it is compatible with Obj-C...

jogboms commented 6 years ago

I hope it doesn't take too long though. You can follow up on that issue and let me know if any errors come up after that has been resolved.