1

I'm having this weird situation over my app. I'm calling performSegueWithIdentifier over the main thread :

  dispatch_async(dispatch_get_main_queue()){

   self.performSegueWithIdentifier("toFrame", sender: nil)

    }

I've set breakpoints thru the process, and even cleaned prepareForSegue.

Only for the first time when i'm calling this(to this specific VC),it's delayed for about 6 seconds, and than moving to the VC. After this delay, if i'm navigating back and forth, it runs smoothly Any suggestions? Ive tried everything :\

toddg
  • 2,863
  • 2
  • 18
  • 33
Roi Mulia
  • 5,626
  • 11
  • 54
  • 105
  • Are you sending data? – Sam Bellerose May 12 '16 at 16:08
  • @sambellerose , No, i've cleaned my prepareForSegue completely – Roi Mulia May 12 '16 at 16:09
  • check viewDidLoad method in controller that you're presenting, issue can be there. Also please specify on which device you're testing and try using instruments to localize your issue. – Vlad Z. May 12 '16 at 17:24
  • @anonymous Hey. I've putted a breakpoint at the ViewDidLoad at the presented VC, it's not part of the delay - it getting called after the delay. As well testing at the a real iPhone 6 & 5. I've tried using instruments, But i haven't fully understand which one could assist me. To be honest, i think my project got broken some how, cuz i can't really think on something reasonable, because after this first time it runs smoothly. – Roi Mulia May 12 '16 at 17:33
  • @RoiMulia i would suggest to use time profiler under instruments - here's tutorial how to use it - https://www.raywenderlich.com/97886/instruments-tutorial-with-swift-getting-started. My theory is that something happening on main thread the first time - and then it's stored. But without code we can only speculate about this problem. – Vlad Z. May 12 '16 at 17:41
  • be wear, for if you are already on the main thread, calling dispatch_sync(dispatch_get_main_queue()) will wait forever – Vlad Z. May 12 '16 at 17:46
  • Hey @anonymous. Any chance we can move to private chat? I can't seems to fix this scenario, and you are the only one who even tried helping me lol. Thanks, much appreciated! Roi – Roi Mulia May 12 '16 at 17:54
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/111793/discussion-between-roi-mulia-and-anonymous). – Roi Mulia May 12 '16 at 17:54
  • @anonymous Ive used time profiler, And trigger the segue in the main theard,(verify i'm not on it first). There is 3300 ms delay, if i'm checking "Hide System Laberies", as far as i can see my code is not the one triggering this, because i'm not seeing the responsible method who's causing this .. :\ – Roi Mulia May 12 '16 at 18:08

1 Answers1

1

It can be fonts issue: if you select them in IB and didn't check target membership - system will look for them before retrieving default font - and thus will create delay before presenting controller.

Please check font's target membership.

It’s famous bug with modal presentation:

http://openradar.appspot.com/19563577

Vlad Z.
  • 3,401
  • 3
  • 32
  • 60