Can I use react-native app's AppDelegate in ios module? - ios

I am writing iOS SDK wrapper for react native.
And the SDK guide gave me the code :
-(void)didClickOpenOfferwallBtn
{
[AdPopcornOfferwall openOfferWallWithViewController:self delegate:self userDataDictionaryForFilter:nil];
[AdPopcornOfferwall shared].delegate = self;
}
So I think if I can get my react-native App's AppDelegate, (like Androids's getReactApplicationContext or getCurrentActivity functions) I can run the code inside of react-native ios module.
Are there some methods to get my current app's AppDelegate in React Native module?

Related

HomeKit Delegate APIs not working inside iOS flutter plugin

I am developing a flutter plugin for accessing Apple HomeKit features inside my flutter app. The following project and code setup is done for iOS project inside flutter folder:
Project setup:
1. Enabled HomeKit in Capabilities
2. Added Privacy – HomeKit Usage Description Key in Info.plist
Code Setup inside plugin:
1. Created instance of HMHomeManager
2. Set the HMHomeManager delegate
3. Implemented delegate methods
Also, cross verified the access to HomeKit for my flutter app in the Settings.
Issue 1:
For the same set up, a native iOS application is running fine and homeManagerDidUpdateHomes delegate method is getting called immediately after accessing HomeKit Database which is properly providing Home information.
But, in flutter plugin, delegate method is not getting called and always home count is Zero.
Issue2:
I have written code to add new HomeKit Home inside iOS plugin and tried calling the method from flutter UI. Strangely the code inside addHome(withName: ) block is not executing but Home is getting created inside HomeKit database. This is confirmed by running Apple ‘Home’ app.
In this case also, homeManager(didAdd home: ) delegate method is not called.
Version details:
Xcode: 11.2, swift 4.2
Flutter: 1.14.6, Dart: 2.8.0
Does any other set up is required in flutter plugin to set HomeKit Delegate?
As an alternative approach, also tried using cupertino_ffi_generated 0.1.1 (https://pub.dev/packages/cupertino_ffi_generated) which is a recent package from flutter for accessing Apple APIs. (Even though it is directly mentioned: “Most Flutter developers should not use this package. It's almost always a better idea to write a Flutter plugin than use this package.” ).
But, flutter throwing an error ‘Target of URI doesn't exist:’
Version details:
Flutter: 1.14.6, Dart: 2.8.0
I was facing a similar problem. iOS swift delegate methods were not triggered. It appears that the methods must have been declared public.
Just replace
func addHome...
with
public func addHome...
Maybe it will helps someone...

Calling Paytm SDK using Appcelerator IOS module

I need to Integrate Paytm payment gateway from an Appcelerator project for IOS devices. So I was thinking to use the mobile module to call the SDK. I can build and run their sample SDK using Xcode project and get the result, but having difficulties to implement in my modules. From my understanding:
The SDK is trying to call a webview and send the data then get response from it.
In the SDK ViewController, it extends to UIViewController <PGTransactionDelegate> but the module is extended to TiModule. My guess is that I need to create a ViewController and call it from the module, but somehow it always failed when I build the Appcelerator project using that module. The cause is probably this line in the module function (if I comment it, I can build the project and get the value) :
-(id)makePayment:(id)args {
ViewController *controller = [[ViewController alloc] init];
[[TiApp app] showModalController:controller animated:YES];
NSString *orderID = [args objectAtIndex:0];
return orderID;
}
Is there anyone who able to integrate Appcelerator with Paytm SDK? Any leads or subtle example is very much appreciated.
Paytm SDK : https://github.com/Paytm-Payments/Paytm_iOS_App_Kit
Appcelerator version 4.10
Titanium SDK version 6.1.2.GA
Xcode version 9.1
TBH I am new to both iOS and Appcelerator, but this is client's requirement.

QuickBlox iOS SDK , Enabling Cloud Back-End Server AUTHKEY/APPLICATION ID TO APP DELEGATE

I have followed all the guidelines of how to set up the iOS SDK that QuickBlox provides. I added the SDK through cocoa pods, added the run script with the snippet code. example here! I came to a crossroad and got stuck in how to add the auth-key, app-id.. ect. To The app delegate?
This is how you set the values in AppDelegate for QuickBlox
First
import Quickblox
in your AppDelegate, then in didFinishLaunching add this
QBSettings.setApplicationID(yourAppId)
QBSettings.setAuthKey(yourAuthKey)
QBSettings.setAuthSecret(yourAuthSecret)
QBSettings.setAccountKey(yourAccountKey)

Integrating IMA iOS SDK

I have integrated google SDK manually without cocoapods because I'm using it inside a static library. And I have added all the frameworks (AVFoundation,..Etc) needed for IMA SDK.
My app getting crashed whenever I am trying to set IMASettings with the language.
Here is the error:
+[NSDictionary gtm_dictionaryWithHttpArgumentsString:]:
"unrecognized selector sent to"
This is my code :
- (IMASettings *)createIMASettings {
IMASettings *settings = [[IMASettings alloc] init];
settings.language = #"en";
return settings;
}
I have initialized the ads loader here :
self.adsLoader = [[IMAAdsLoader alloc] initWithSettings:[self createIMASettings]];
You miss a category with the method gtm_dictionaryWithHttpArgumentsString
now most likely, this IS part of the SDK but haven't setup the linker right
add -ObjC to your app's linker flags
if that isn't it, you're missing another framework from google - the google toolbox for mac

How to provide Aviary Apikey and Secret to Cordova Plugin for iOS

I currently try to get the aviary sdk to run in combination with a cordova app under iOS.
After installing cordova (3.6.3-0.2.13) and the latest Aviary SDK (4.3.0) and the aviary plugin from https://github.com/m1is/AviaryCordovaPlugin I managed to get a simple example app to work with android.
When I try to build the exact same app for iOS with xcode(6.0.1) and i try to call the cordova.plugins.Aviary.show method, I get the following error in the xcode console:
WebKit discarded an uncaught exception in the
webView:decidePolicyForNavigationAction:request:frame:decisionListener:
delegate: You must provide your Aviary
API key before creating an instance of the AFPhotoEditorController.
Please see the Aviary SDK documentation for details.
I understand from reading the SDK documentation for iOS that aviary changed the apikey/secret setup to require it to put it in the code:
The API key and secret must be provided before instantiating an
instance of AFPhotoEditorController.
and here my problem arises: I do not have any idea on how to submit the apikey/secret to the SDK, all tries changing or adding stuff to the Aviary.m file were unsuccessful (probably since I have no knowledge of ObjectiveC.
So I wonder if anybody had the same problem and is able to point me to the right direction on how to setup the apikey and secret so my cordova app would run under iOS.
It looks like the plugin maintainer was focused on android and the iOS version is unfortunately not on the same standard. If you still have this issue you can solve it by manually editing the plugin's iOS code. Just locate the line self.aviary = [[AFPhotoEditorController alloc] initWithImage:image]; in Aviary.m and add the following few lines above it:
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
[AFPhotoEditorController setAPIKey:#"YourAviaryAPIKey" secret:#"YourAviarySecret"];
});

Resources