Flutter module in native ios app is not completely closing the module - ios

I'm facing issue after integrating flutter module into a native ios app. After closing the flutter module either by using SystemNavigator.pop(animated:true), when trying to open it again from native ios app, the flutter module lands on the recently closed screen. I have even tried by invoking a method from flutter module and closed the flutterViewController from native ios app, which again closes the app but opens the same screen that was exited before. Also, destroying the flutterEngine also didnt work.
Could anyone please share your knowledge regarding this. It will be really helpful.
FlutterEngine *flutterEngine = ((AppDelegate *)UIApplication.sharedApplication.delegate).flutterEngine;
FlutterViewController *flutterViewController = [[FlutterViewController alloc] initWithEngine:flutterEngine nibName:nil bundle:nil];
FlutterMethodChannel *channel = [FlutterMethodChannel methodChannelWithName:#"com.sara.app/myAppChannel" binaryMessenger:flutterViewController.binaryMessenger];
//exitUpiModule triggered from flutter module
[channel setMethodCallHandler:^(FlutterMethodCall * _Nonnull call, FlutterResult _Nonnull result) {
if([call.method isEqualToString:#"exitUpiModule"]){
//CLOSES THE FLUTTER MODULE BUT WHEN OPENED IT LANDS ON THE SAME SCREEN
[flutterViewController dismissViewControllerAnimated:YES completion:nil];
}
}];
Tried dismissing the flutterViewController, detroyContext but didnt work.

Related

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

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?

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.

your app loads indefinitely upon launch

I have an app which works fine on below devices.
iPhone 4s (iOS 7.1)
iPhone 5 (iOS 9.1)
iPhone 6 (iOS 9.1)
However app is rejecting saying below rejection.
We discovered one or more bugs in your app when reviewed on iPad and iPhone running iOS 9.1 on both Wi-Fi and cellular networks.
App did not load its contents, did not load beyond the flash screen.
However when I run this from my side, its working fine but it has problem at Apple end only. I don't know how can app run at my end and its giving problem at Apple end only? I tried to upload with iOS 8.4, but still Apple reply still we can't go beyond splash screen.
Did anyone face such issue OR does anyone point me where I can be wrong?
I have uploaded 6 builds and all are rejected saying same reason.
Note: Same app was working fine earlier (before iOS 9.1 release), but when I try to upload now, it is giving this error.
The biggest challenge for me is, I don't know what is the problem, but I need to FIX this problem
Edit 1
I have first screen as language screen where I have animation of images.
animationImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 1080, 1920)];
animationImageView.hidden = NO;
animationImageView.animationImages = mArray;
animationImageView.animationDuration = 1.5;
animationImageView.animationRepeatCount = 1;
[self.view addSubview:animationImageView];
[animationImageView startAnimating];
After testing on testflight, I found a problem.
If I open the app after clicking app icon, it was working fine.
The problem comes when I click Open button from testflight
When I click Open button, launchOptions in AppDelegate was not nil, so the code in push was going wrong and internally it was crashing but still app was hanged at splash screen (not sure why though)
Below is what I have when I print launchOptions in AppDelegate didFinishLaunchingWithOptions
launchOptions==={
UIApplicationLaunchOptionsSourceApplicationKey = "com.apple.TestFlight";
}
So I changed my code to below and all is working perfectly.
NSLog(#"launchOptions===%#", launchOptions);
if (launchOptions!=nil) {
NSMutableDictionary *userInfo = [launchOptions objectForKey:UIApplicationLaunchOptionsRemoteNotificationKey];
NSLog(#"userInfo===%#", userInfo);
NSLog(#"userInfo===%d", userInfo.count);
if (userInfo.count>=1) {
// here is my code on what to do if i click on push
}
}
Do let me know if someone is not clear
It was crashing saying below
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[NSPlaceholderString initWithString:]: nil argument'
So I feel problem was at line below.
NSString *badge =[[NSString alloc] initWithFormat:#"%#", [apsInfo objectForKey:#"badge"]];
But after putting above condition, all was working fine.
Did you test using "Run" from Xcode, or using Test Flight? Test Flight gets you the app in the same environment as Apple gets it, while running directly from Xcode may yield different results (different push notification environment, possibly different compilation options...).
Also, do you have access to the logs of the server that the app queries? If so, have you checked them to see what happens when Apple try to use the app? Is the query correctly formed? Was there an error (status code different from 200, or in the error log)?
What kind of request does your app perform? Is it a regular http(s) request? Or are you using an unusual protocol which may be blocked somehow?
I suppose the server queried is fully reachable from the Internet (i.e. you did not put a server that is only accessible on your local network)?
You should add error handling in your code, to test the result of requests and display information about it, so that if there's an error when they test it, at least they can report what the error is.

FBSDKGameRequestDialog error with landscape app

in my project i call this function: (Facebook SDK for iOS version v4.1.0)
FBSDKGameRequestContent *gameRequestContent = [[FBSDKGameRequestContent alloc] init];
gameRequestContent.message = #"Choi thu nhe, hay lam day";
gameRequestContent.title = #"Monkey Junior";
gameRequestContent.to = friends;
dialog = [FBSDKGameRequestDialog showWithContent:gameRequestContent delegate:(id)self];
Image:
Our app is in landscape and the Facebook friend invite dialog is in portrait and the buttons Send and Cancel are located outside the screen.
Please help me.
This is a known issue with the FB SDK for iOS being tracked here.
This issue is seen in iOS 7.x so if it is blocking you then you can maybe at least test your functionality (if feasible) in iOS 8.x till the fix is released.

twitter sharing using sharekit crashing in ios 5

Hi I'm trying to a share images using sharekit on twitter,from app. I have added a twitter icon and when clicked I call this function
-(void)shareTwitter
{
SHKItem *itemshare = [SHKItem image:imgView.image title:projectname];
[SHK setRootViewController:self.navigationController];
[SHKTwitter shareItem:itemshare];
}
after this function is executed the app crashes saying exec_bad_access in sharekit code.
I have added the piece of line below where it occurs.
iOS5twitter.completionHandler = ^(TWTweetComposeViewControllerResult result) ;
I tried to reproduce the same issue with the demoapp provided by sharekit.The app runs fine and even posts image.
The crash appears before login authentication. can someone guide me thru this and help me fix this issue
thanks

Resources