I have a Flutter app that uses a package to login via a third party, and I want to run it over iOS and Android devices.
When this app is ran on Android, it doesn't have any issues and I can work on the app smoothly, but now that I'm trying to release a version for iOS (first I build it via Xcode, then I push it to the Apple developer membership account, and then I install it on my iPhone), to login via Google (or Facebook or Twitter) I need to click a "Share Your Information" dialog, but this disappears before I can click it. Is there any special permission I should activate to solve this issue?
Please consider that this is the first app I try to release using an Apple Membership, so you can take this question as one made by a person with almost zero knowledge of Apple development.
Here is the dialog that disappears. It gives enough time to see it, but it disappears 1 second later and you can't click on any of both buttons.
EDIT:
This is the process after following the instructions in the first answer of @lepsch (I really appreciate your effort in helping me, sorry for the bombarding of questions)
[!] CocoaPods could not find compatible versions for pod "web3auth_flutter":
In Podfile:
web3auth_flutter (from `.symlinks/plugins/web3auth_flutter/ios`)
Specs satisfying the `web3auth_flutter (from `.symlinks/plugins/web3auth_flutter/ios`)` dependency were found, but they required a higher minimum deployment target.
CodePudding user response:
The problem is that web3auth_flutter needs iOS 13 as deployment target but the project is configured to use 12. Go to the file ios/Runner.xcodeproj/project.pbxproj
and update the 3 references from IPHONEOS_DEPLOYMENT_TARGET = 12.0;
to IPHONEOS_DEPLOYMENT_TARGET = 13.0;
.
Also, the web3auth_flutter
dependency in pubspec.yaml
is pointing to an old fork on Github, version 0.0.2
, instead of the latest version 1.0.0
. Just update pubspec.yaml
like the following and run flutter pub get
.
# ...
dependencies:
web3auth_flutter: ^1.0.0
# ...
The web3auth_flutter
version 1.0.0 needs some changes in the source. Here they are (clientId
, redirectUrl
, and whiteLabel.name
have been redacted to xxx
):
Future<void> initPlatformState() async {
HashMap themeMap = HashMap<String, String>();
themeMap['primary'] = "#fff000";
await Web3AuthFlutter.init(Web3AuthOptions(
clientId: 'xxx',
network: Network.mainnet,
redirectUrl: Uri.parse('xxx://auth'),
whiteLabel: WhiteLabelData(
dark: true, name: "xxx", theme: themeMap),
));
}
// ...
// Functions to log in/out
VoidCallback _login(Future<Web3AuthResponse> Function() method) {
return () async {
try {
final Web3AuthResponse response = await method();
final prefs = await SharedPreferences.getInstance();
var privKey = response.privKey;
var ec = getS256();
var privHex = PrivateKey.fromHex(ec, privKey!);
var pubKey = privHex.publicKey.toCompressedHex();
String authToken = createToken(privKey);
await prefs.setString('token', authToken);
await prefs.setString('public-key', pubKey);
setState(() {
_result = prefs.getString('token');
_mail = response.userInfo!.email.toString();
_name = response.userInfo!.name.toString();
});
await Navigator.pushNamed(context, "/homepage");
} on UserCancelledException {
print("User cancelled.");
} on UnKnownException {
print("Unknown exception occurred");
}
};
}
Future<Web3AuthResponse> _withGoogle() {
return Web3AuthFlutter.login(LoginParams(
loginProvider: Provider.google, mfaLevel: MFALevel.MANDATORY));
}
Future<Web3AuthResponse> _withFacebook() {
return Web3AuthFlutter.login(LoginParams(
loginProvider: Provider.facebook, mfaLevel: MFALevel.MANDATORY));
}
Future<Web3AuthResponse> _withTwitter() {
return Web3AuthFlutter.login(LoginParams(
loginProvider: Provider.twitter, mfaLevel: MFALevel.MANDATORY));
}
Future<Web3AuthResponse> _withMail() {
return Web3AuthFlutter.login(LoginParams(
loginProvider: Provider.email_passwordless,
mfaLevel: MFALevel.MANDATORY,
extraLoginOptions: ExtraLoginOptions(login_hint: _mail),
));
}
}