Flutter no OAuth result from Magic Link only on iOS - ios

I am using magic_sdk: ^0.3.1 and magic_ext_oauth: ^0.1.0 in flutter to implement a login.
This is the code I am using
try{
Magic magic = Magic.instance;
if (loginType == OAuthProvider.GOOGLE) {
Logger().w('logging with google'); //working
var configuration = OAuthConfiguration(
provider: OAuthProvider.GOOGLE,
redirectURI: 'magicauthentication://');
Logger().w('logging configuration added'); //working
var result = await magic.oauth.loginWithPopup(configuration);
Logger().w('popup passed'); //not working
Logger().w(result.magic!.toJson());
var token = result.magic!.idToken;
exchangeToken(context, token);
}
} catch (e) {
Logger().e(e); //not working
}
This code works fine without any bugs on Android. On iOS it does not. I added loggers to check the executing lines. There are marked in the above code as working and not working.
Since I had to add android schemas to work on Android I also added applinks on iOS
What can be the problem here why it is not giving result only on iOS ?
Is there anything more that I need to add?

as it is clear from the score section of it, it doesn't support multiple platforms, try the recent one.

Related

React Native: react-native-nfc-manager v3.13.2 doesn't have a handler for MifareIOS data type

I am working on an app, that reads a Firestore document id from the NFC card and displays the data contained by this document.
I have tested it on an Samsung J6 and an Oppo for Android and on an iPhone 7 & 12 Pro Max and everything worked perfectly with react-native-nfc-manager v3.10.1.
After I have updated this package to the lastest version (3.13.2), the methods for reading data from the NFC card have changed, e.g:
let tech = Platform === 'ios' ? NfcTech.MifareIOS : NfcTech.MifareUltralight;
...
// for Android
const resp = await NfcManager.mifareUltralightHandlerAndroid.mifareUltralightReadPages(6);
// instead of
const resp = NfcManager.transceive([...]);
// for iOS
const resp = await NfcManager.?.mifareUltralightReadPages(6);
// instead of
const resp = NfcManager.sendMifareCommandIOS([...]);
The problem arises for iOS (where I gave put the ?). Apparently there is no handler for the MifareIOS nfcTech type.
Does anyone have any idea if it will come in the future or if, at the moment, other handler could be used instead?
Thanks a lot!!!

CrossGeolocator iOS Issue: Either just use events or your own delegate

I've been trying to fix this issue for two days now.
This is a Xamarin.Forms application. The Android side is working perfectly. On the iOS, however, I keept geeting this error.
I have a single button in the center of my screen. When it's clicked, it uses the CrossLocator class to get the Geolocation of the phone. However, this problem keeps ocurring:
Erro: Evento registration is overwriting existing delegate, Either just use events or your own delegate:Plugin.Geolocator.GeolocationSingle-UpdateDelegateCoreLocation.CLLocationManager+_CLLocationManagerDelegate
Here's my code:
`public static async Task<Tuple<Position, string>> GetLocalizacao()
{
var locator = CrossGeolocator.Current;
try
{
locator.DesiredAccuracy = 50;
var position = await locator.GetPositionAsync(TimeSpan.FromMilliseconds(10000));
}
catch (Exception ex)
{
return new Tuple<Position, string>(null, $"Erro: {ex.Message}");
}
var localizacaoFinal = await locator.GetPositionAsync(TimeSpan.FromMilliseconds(10000));
return new Tuple<Position, string>(localizacaoFinal, "");
}`
The exception happens when it hits "GetPositionAsync". From there on, I don't know what to do, nor how to actually identify the issue itself.
If anyone stumbles upon this post, I've been stuck with this issue since I posted it. Still can't get it to work in these conditions. The only way my app worked was downgrading all packages I needed for this.
In order for it to work, it now has:
Xam.Plugin.Geolocator, version 4.5.0.6
Xamarin.Forms, version 5.0.0.2012
Xamarin Essentials, version 1.6.1
Plugin.Permissions, version 6.0.1

Question from Flutter novice developer about 'await'

I'm an iOS developer starting to look into Flutter. I'm following this tutorial from Ray Wenderlich and I'm facing a strange behaviour from this code.
_loadData() async {
var dataURL = "https://api.github.com/orgs/raywenderlich/members";
var response = await http.get(dataURL);
setState(() {
_members = json.decode(response.body);
});
}
Problem is that execution is stopped at var response = await http.get(dataURL);
I know is related to the await but I'm not sure why is happening. On the example code from the http package is using a similar code.
Can anyone help?
Thanks
So, the reason of the unresponsive await was due to the Android simulator. I don't know why but connection is not working on the simulator. I tested with the iOS simulator and worked.
if it is stopped it might be because the url does not return anything, maybe because the url is wrong? also i think string should use single quotations ' instead of ". try replacing it with single quotations?

ZXing barcode scanner in Xamarin Forms on iOS doesn't read barcodes

I'm working on a Xamarin Forms PCL project targeting Android and iOS that needs some basic barcode scanning functionality.
I got things up and running with the forms version of the ZXing.Net.Mobile package following this tutorial and referencing this guide and it works great on Android. However, on iOS the camera comes up but the OnScanResult event is never fired.
I've tested it on several iOS devices running several different versions (anywhere from 8.0 - 10.3) and fiddled with everything I can think of, referencing their sample projects as well. ZXing.Net.Mobile and ZXing.Net.Mobile.Forms nuget packages were installed in all projects.
Here's my scanner code, triggered from a button press on my main page:
var scanPage = new ZXingScannerPage();
scanPage.OnScanResult += (result) =>
{
scanPage.IsScanning = false;
Device.BeginInvokeOnMainThread(async () =>
{
await Navigation.PopAsync();
await DisplayAlert("Scanned Barcode", result.Text, "OK");
});
};
await Navigation.PushAsync(scanPage);
and AppDelegate.cs:
public override bool FinishedLaunching(UIApplication app, NSDictionary options)
{
global::Xamarin.Forms.Forms.Init();
global::ZXing.Net.Mobile.Forms.iOS.Platform.Init();
LoadApplication(new App());
return base.FinishedLaunching(app, options);
}
After two days of fighting with this, I feel like I'm at my wit's end. Has anyone else encountered similar problems? Thanks for any guidance!
Edit 1
Here's the device log output (Message column only) when clicking the button to trigger the above code. No log items are added while the camera is open and pointed at various barcodes. I don't see anything suspicious here, but maybe someone else does?
PERF: Alloc AVCaptureVideoPreviewLayer took 14.14 ms.
AppleH4CamIn::power_on_hardware
AppleH4CamIn::ISP_SelectBestMIPIFrequencyIndex_gated - channel: 0, index: 0
StartScanning
AppleH4CamIn::setPowerStateGated: 1
ZXingScannerView.Setup() took 0.167 ms.
ASL Sender Statistics
AppleH4CamIn::ISP_FlushInactiveDARTMappings: 0x00000000
AppleH4CamIn::ISP_SelectBestMIPIFrequencyIndex_gated - channel: 0, index: 0
Edit 2
I ran the sample Xamarin Forms PCL from the github repo and am having the same problems on iOS with the camera opening fine, but no barcode ever read. Therefore I'm thinking the problem must be with my Visual Studio and/or Xamarin setup. I'm running Visual Studio 2015 Community on the stable Xamarin channel.
add this on ios
protected override void OnAppearing()
{
base.OnAppearing();
qrcode.IsScanning = true;
}`enter code here`
protected override void OnDisappearing()
{
qrcode.IsScanning = false;
base.OnDisappearing();
}
Try using this:
scanPage.IsAnalyzing = true;
IsAnalyzing is different from IsScanning.
I faced the same the issue like you. But after using IsAnalyzing = true; It is fixed.
I finally got it working with this project as a starting point. It's just a basic barcode scanning implementation using ZXing, but for whatever reason I could finally read barcodes on iOS.
It's probably a version-related problem, but I couldn't narrow it down.
Edit
I posted this same question in the Xamarin Forums: https://forums.xamarin.com/discussion/comment/272209#Comment_272209
It seems the answer was downgrading to ZXing version 2.1.47. I haven't done any work with the library for a few months so I haven't tested new versions.

PushPlugin Not Asking for Permissions on iOS

I'm working on setting up Push Notifications for an iOS app using the Ionic Framework but I'm running into a problem.
I added the plugin using the following
ionic plugin add https://github.com/phonegap-build/PushPlugin.git
and then added the following to my services.js file:
window.onNotificationAPN = function(event){
alert(event);
}
angular.module('starter.services', [])
.run(function($ionicPlatform){
$ionicPlatform.ready(function($scope, $window){
var tokenHandler = function(result){
alert('tokenHandler' + result);
}
var errorHandler = function(error){
alert('errohandler' + error);
}
var pushNot = window.plugins.pushNotification;
pushNot.register(
tokenHandler,
errorHandler,
{
"badge":"true",
"sound":"true",
"alert":"true",
"ecb":"onNotificationAPN"
}
);
});
})
When I run the app on my test device (running iOS 6.1.6) using command+R or sending it using testflight the application runs but never asks for permission to send push notifications and the the tokenHandler function is never called. Any help would be greatly appreciated.
Thanks for asking the question. I was searching for this for hours.
Turns out the solution for me was making sure that the opening angular module line in the app.js file included the ionic.service.core module dependency.
Then everything worked.
NOTE: (i wish it had thrown an error instead of allowing the push.register call to actually return a token)
angular.module('starter', ['ionic', 'ionic.service.core'])
The way I was able to solve this was to switch over to using ngCordova's Push script with the PushPlugin.

Resources