【问题标题】:Condition not behaving properly at iPad条件在 iPad 上表现不正常
【发布时间】:2017-07-28 09:37:31
【问题描述】:

在我的应用程序中,我有 if-else 条件,问题是这种情况在模拟器(iPhone 以及 iPad)和 iPhone 设备上表现正常,但在 ipad 设备上表现不正常。有没有可能解决这个问题?

if (_loginForCoDriver ) {
    NSString *name=[[APPDELEGATE.coDeriverDetailArr objectAtIndex:0] objectForKey:@"name"];

    NSString *password=[[APPDELEGATE.coDeriverDetailArr objectAtIndex:0] objectForKey:@"driver_pass"];
    //[[APPDELEGATE.coDeriverDetailArr objectAtIndex:0] objectForKey:@"driver_pass"];

    if ((usernametext.text==name) && (passwordtext.text==password) ) {
         [self logoutAPI];
        //modeStr=@"Logging";
        [ProgressHUD show:@"Please wait..." Interaction:NO];
        //https://mobile.epgsolutions.net/

        //   NSString *strURL =[NSString stringWithFormat:@"http://projects.udaantechnologies.com/epg_services/user_login.php"];
        NSString *strURL =[NSString stringWithFormat:@"%@%@",_baseurl,@"user_login.php"];
        // NSString *strURL =[NSString stringWithFormat:@"https://mobile.epgsolutions.net/user_login.php"];

        ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:[NSURL URLWithString:strURL]];
        [request setDelegate:self];

        [request setPostValue:usernametex.text forKey:@"number"];
        [request setPostValue:passwordtex.text forKey:@"password"];
        [request setPostValue:@"1" forKey:@"device_type"];
        [request setPostValue:APPDELEGATE.deviceTokenStr forKey:@"access_token"];
        [request setUploadProgressDelegate:self];
        [request setTimeOutSeconds:200000.0];
        [request startAsynchronous];
    }
    else{
        [[[UIAlertView alloc]initWithTitle:@"Alert" message:@"Id/Password doesn't Match !" delegate:self cancelButtonTitle:@"Re-Enter" otherButtonTitles:@"Go Back", nil] show];

                }

   }

【问题讨论】:

  • 你能分享一些代码吗?

标签: ios


【解决方案1】:

UIAlertView 已弃用。改用 UIAlertController 和 UIAlertControllerStyleAlert 的preferredStyle。 从 iOS8 开始,Apple 提供了新的 UIAlertController 类,您可以使用它来代替现在已弃用的 UIAlertView,它也在折旧消息中说明。

我阅读了你的代码,它很完美,除了这个 UIAlertView 什么都没有发现。

也许这会起作用。

【讨论】:

  • 在 iPhone 中它工作正常,模拟器也一样。只有 iPad 有问题。在 iPad 中,如果条件为真,它会跳转到 else 条件。
  • 我同意。是时候升级到 UI 警报控制器了。
  • 确保您的 iPad 在最新的 iOS 版本上运行。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2015-03-17
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多