问题
I implemented an app that does real time broadcasting of music from one iphone to another based on Ray Wenderlich's tutorial about GKSession and Matt Ghallagher's tutorial on audio streaming.
Everything worked perfectly.. until we've decided to replace the poker game UI with that of our own. The result is that suddenly the networking throughput drops dramatically. Below is a profiler snap shot of the server
Here is a snapshot of the client of the original app
and here is a snapshot of the client of the app with the updated UI (host is the same as old one):
One thing to keep in mind is that we didn't just change the UI.. we also changed a bit of the networking code.. which is what I believe is slowing things down (I did a lot of performance testing ont the UI.. eliminating all the bells and whistles and the I got the same slow down)..
any ideas? some suggested that keeping a GKSession broadcasting availability slows thing down a bit.. I made sure that that's not the case in my app..
Update: After looking at the network analysis (using instruments) it seems that there is a lot of network activity by some unknown process.. is there a way to detect that unknown process? this is the screen shot for the good app:
and here is the screen shot for the bad app:
notice the difference between the two: in one other uses a lot more network activity than the other.. ideas?
回答1:
Turns out that I had two different objects pointing to the same GKSession instance variable.. for some reasons that slowed things down.. the frustrating part is that GKSession is so opaque and so any debugging is pretty much guestimation. Lesson learned.. I'll just directly use bonjour next time.
来源:https://stackoverflow.com/questions/13413271/what-slows-down-gksessions-network-throughput