今天我发现了一个关于Xamarin Forms(Android)的问题 - iOS运行良好。
Zxing在构造函数中初始化。 权限已正确设置。
重现步骤:
- >现在你得到一个黑屏。
如果我回到方法的应用程序
import java.util.Scanner;
import java.io.*;
public class Part2
{
public static void main (String[]args)
{
Scanner scan = new Scanner(System.in);
String userInput1 = " ";
char player1Input;
String userInput2 = " ";
char player2Input;
for(int i = 0; i < 5; i++) //Loop for game
{
System.out.println("Player 1: Please Enter e.g R for Rock:");
System.out.println("R.Rock");
System.out.println("P.Paper");
System.out.println("S.Scissors");
userInput1 = scan.next();
player1Input = userInput1.charAt(0);
System.out.println("Player 2: Please Enter e.g S for Scissors");
System.out.println("R.Rock");
System.out.println("P.Paper");
System.out.println("S.Scissors");
userInput2 = scan.next();
player2Input = userInput2.charAt(0);
}
switch(player1Input)
{
case 'R': System.out.println ("Player 1:Rock");
switch(player2Input)
{
case'R' : System.out.println("Player 2:Rock");
System.out.println("The Game Result is Draw");
break;
case'P' :System.out.println("Player 2:Paper");
System.out.println("The Game Result is: Player 2 Wins");
break;
case'S' :System.out.println("Player 2:Scissors");
System.out.println("The Game Result is: Player 1 Wins");
break;
default: System.out.println("Invalid Option");
break;
}
break;
case 'P' : System.out.println ("Player 1:Paper");
switch(player2Input)
{
case'R' : System.out.println("Player 2:Rock");
System.out.println("The game result is: Player 1 Wins");
break;
case'P' :System.out.println("Player 2:Paper");
System.out.println("The game result is: Draw");
break;
case'S' :System.out.println("Player 2:Scissors");
System.out.println("The Game Result is: Player 2 Wins2");
break;
default: System.out.println("Invalid Option");
break;
}
break;
case 'S' : System.out.println ("Player 1:Scissors");
switch(player2Input)
{
case'R' : System.out.println("Player 2:Rock");
System.out.println("The Game Result is: Player 2 Wins");
break;
case'P' :System.out.println("Player 2:Paper");
System.out.println("The game result is: Player 1 Wins");
break;
case'S' :System.out.println("Player 2:Scissors");
System.out.println ("The Game Result is: Draw");
break;
default: System.out.println("Invalid Option");
break;
}
break;
}
}
}
叫做。
在这里我设置了protected override void OnAppearing()
如果我在我的应用程序中导航,例如从扫描仪页面导航并导航回来 - 一切正常。
Zxing版本:2.3.2并且还使用2.3.1进行了测试 XamarinForms版本:2.5.0.91635
适用于iPhone SE,7,X上的iOS 10-11 在Galaxy S7,华为P8,LG G3上的Android 6,7上不起作用
答案 0 :(得分:0)
我正在使用Xamarin.Forms
并在InitializeComponent();
中调用OnAppearing()
解决了问题(可能不是最优雅的解决方案,但效果很好)