1
votes

I have a text input field for my form that I am trying to fill out using a modal. But the app crashes on me. The problem occurs on the ios device. It doesn't occur on the web / ionic serve. I didn't test it on Android because I don't own a device. My other Modals work fine.

Repro Steps:

  1. Tap on the modal item
  2. Model Opens
  3. Enter a value in the text field 4 Tap Save Button - The value is returned to the main controller
  4. Tap again to edit the value - The app will hang

If Steps 1,2,3 are repeated by restarting the app and Done button on the device keyboard is tapped it also hangs.

Function Inside Main Controller:

// Code for my Modal Controller:

$ionicModal.fromTemplateUrl('templates/mymodal.html', function(modal) {
$scope.gmodalCtrl = modal;
     }, {
    scope: $scope,
    animation: 'slide-in-left',
    focusFirstInput: true
});

  $scope.gmodalData = {"merchtype" : 'Please pick one'};

  $scope.opengModal = function() {
    $scope.gmodalCtrl.show();
  };

MyApp.controller('MyController', function($scope) {

  $scope.hideModal = function() {
    $scope.gmodalCtrl.hide();
  };
$scope.item = {};
  $scope.doSomething = function(item) {
    console.log('going with G Modal');
  $scope.gmodalData.myrange = $scope.item.myrange;

        console.log($scope.gmodalData.myrange);
        console.log($scope.item.myrange);
    $scope.gmodalCtrl.hide();
  };
});

// HTML to Invoke Modal:

<label class="item"> <button class="button icon-right ion-ios7-arrow-right button-clear button-dark" ng-click="opengModal()">Merchant Name:  {{gmodalData.myrange}}  </button> </label>

// Modal HTML:

<input type="text" style="width: 250px" ng-model="item.myrange">
<button class="button button-block button-balanced" ng-click="doSomething()">Do it</button>

Output in the Xcode Debugger:

Unable to simultaneously satisfy constraints.
    Probably at least one of the constraints in the following list is one you don't want. 
    Try this: 
        (1) look at each constraint and try to figure out which you don't expect; 
        (2) find the code that added the unwanted constraint or constraints and fix it. 
(
    "<NSLayoutConstraint:0x176b75b0 V:|-(20)-[UIInputSetContainerView:0x176b5f70]   (Names: '|':UITextEffectsWindow:0x176b3960 )>",
    "<NSLayoutConstraint:0x176a3210 'UIInputWindowController-top' V:|-(0)-[UIInputSetContainerView:0x176b5f70]   (Names: '|':UITextEffectsWindow:0x176b3960 )>"
)

Will attempt to recover by breaking constraint 
<NSLayoutConstraint:0x176b75b0 V:|-(20)-[UIInputSetContainerView:0x176b5f70]   (Names: '|':UITextEffectsWindow:0x176b3960 )>

Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKit/UIView.h> may also be helpful.
1

1 Answers

1
votes

I get the same problem, my xCode is 7.2(7C68), ionic 1.7.12, cordova 5.1.1, iOS 9.2.

I fix this problem by adding another plugin. Please checkout.

https://github.com/driftyco/ionic-plugin-keyboard

 ionic plugin add ionic-plugin-keyboard
 ionic build ios

then install this app with xCode, the button works.

Hope it will help you.