Ios 未定义的方法“pushViewController';对于nil:NilClass(nomethoderor)

Ios 未定义的方法“pushViewController';对于nil:NilClass(nomethoderor),ios,rubymotion,pushviewcontroller,Ios,Rubymotion,Pushviewcontroller,我开发了一个RubyMoon应用程序,目前正在等待苹果的审查。我已经将Critercism连接到我的应用程序,并注意到在审查过程中,出现了一个错误。但是,我无法在我的iPhone 4S上复制此错误 错误发生在:使用7.1.2的iPad Air和Wifi(非手机数据) 错误是:未定义的方法pushViewController for nil:NilClass(NoMethodError) 这似乎发生在我代码的这一部分: def locationManager(manager, didUpdat

我开发了一个RubyMoon应用程序,目前正在等待苹果的审查。我已经将Critercism连接到我的应用程序,并注意到在审查过程中,出现了一个错误。但是,我无法在我的iPhone 4S上复制此错误

错误发生在:使用7.1.2的iPad Air和Wifi(非手机数据)

错误是:
未定义的方法pushViewController for nil:NilClass(NoMethodError)

这似乎发生在我代码的这一部分:

  def locationManager(manager, didUpdateToLocation:newLocation, fromLocation:oldLocation)
    @my_location_manager.stopUpdatingLocation
    #error occurs on the line below
    self.navigationController.pushViewController(MyController.alloc.initWithData(item, newLocation.coordinate.latitude, newLocation.coordinate.longitude), animated:true)
  end
整个类看起来像这样:

class SomeController < UITableViewController
   def locationManager(manager, didUpdateToLocation:newLocation, fromLocation:oldLocation)
      @my_location_manager.stopUpdatingLocation
      #error occurs on the line below
      self.navigationController.pushViewController(MyController.alloc.initWithData(item, newLocation.coordinate.latitude, newLocation.coordinate.longitude), animated:true)
   end

  def tableView(tableView, didSelectRowAtIndexPath:indexPath)
      initAFNetworkingClient
      @name = self.data[indexPath.row][:name]  
      if @name == "FooBar"

        if (CLLocationManager.locationServicesEnabled)
          @my_location_manager = CLLocationManager.alloc.init
          @my_location_manager.delegate = self

          @my_location_manager.purpose = "To provide functionality based on user's current location"
          @my_location_manager.startUpdatingLocation
        else
          p "Location services are not enabled."
        end
      elsif @name == "Bar"
        self.navigationController.pushViewController(OtherController.alloc.init, animated: true)
      end    
end
class SomeController

有人能解释一下为什么我的应用程序会出现这个错误吗?或者如何在设备上复制问题?或者如果我明显做错了什么

使用发布方案运行,看看是否可以得到错误。是否尝试了
presentViewController
而不是
pushViewController
?@duci9y什么是“发布方案”?用谷歌搜索它。当您在设备上测试应用程序时,您使用调试方案进行测试,当有人从应用程序商店下载并运行应用程序时,它将在发布方案下运行。此时,您的navigationController为
nil