I'm having this problem with playing sounds in my app. I used AudioServices before, but problem was that first sound was played with leg of few milliseconds. Now I tried with AVAudio. But AVAudio slows down my app (or stops it for few milliseconds - probably it stops all timers that are making my objects moving). It is playing the first sound without leg, because I am using "prepareToPlay" but now i got this problem. Is there some way to prepare AudioServices to play?
Anyone some other idea?. Thanks
i've used this for several apps: https://github.com/ymc-thzi/ios-audio-player
But depend if your app requires an interface.
This worked great for me.
I solved my problem. The problem was that I was using the same thread for everything. So I used other thread for sounds and main thread works just perfect now.
Related
I'm working on porting an app from iOS to WinRT/8 Metro/8 Immersive/Whatever the current name is.
On iOS, we have the ability to set Application does not run in background to YES to cause the app to actually quit whenever the user leaves the app.
I would like to figure out how to replicate this behavior in WinRT.
Yes, I understand that this is abnormal behavior.
Yes, I have thought this through.
Yes, I have an extremely good reason for doing this.
I'm assuming that during the userLeavingApp event, I would just call Application.Current.Exit(), but I can't seem to find the userLeavingApp event. I thought about using OnSuspending (Handles Me.Suspending) in App.xaml.vb, but that doesn't seem to be called quickly enough for me.
Is there a .NET equivalent of viewWillDisappear or something?
Any ideas? This is an important security characteristic of my app, and I'd hate to have such difficulty in an entire platform due to such a small issue.
Thanks!
I'm not actually seeing Application.Current.Exit() working in OnSuspending; although as you mention the suspending isn't happening fast enough for you (which is by design). Throwing an exception there didn't work for me either.
There is Window.VisibilityChanged and if I issue Exit/exception there, it does shutdown the app when another app takes over. That said, VisibilityChanged will fire under other circumstances too so not sure if you could cover all the scenarios or rely on them not changing. See here for a bit more context.
To echo #Filip, whose response just popped in, it's highly unlikely you'll pass certification. An Exit() call is tantamount to an exception.
I don't think your app will pass certification if you call Application.Current.Exit(). If you are really confident this is what you want - I guess it is worth a shot to try. You could though simply unload anything that uses memory/CPU when you exit.
I recently have been getting memory warning messages when I load my app on my iPhone. I believe it has something to do with the storyboard that I recently switched over to from the classic .xib files. The app has been running a lot slower since and I don't get why. I got rid of a ton of my code that I was using for loading views, making tables, etc., so I would think that my app would run a lot faster now than it did before. My mainViewController (which is giving me the most problems), only has the default code in it! Is there a reason for this to be happening? Was the code running faster than storyboard or something?
Thanks in advanced.
Profile using Instruments to understand your app's execution -- CPU time (slow) and Allocations (memory consumption).
I have an application used mainly with uiwebview since we have a lot of work based on the website so it is quicker to show it directly on webview without re-coding it. The problem with webview, it is very expensive on memory. The UI is running fine throughout 10 times of going through from beginning of the application to the end of the application and repeating the process. On the other hand, the webview started to get slow when it doing some javascript animation using Canvas object. I have put in some code to remove NSUrlCache when it received warning.
Our application is based on navigating through stacked pages. When it gets to the end, user basically goes back to beginning. In my mind, I wanted to relaunch the application when I knows the application started to run slow. I know it is not a good idea to do this but I don't know what is the best way of reclaim the memory. I have looked through all of my code and have released what i have to released. The Application is going well without problem but it is just the uiwebview caused the performance.
Please Help...
Short answer: Not possible. You'll have to find a different way to address your performance problems.
If UIWebView is bottlenecking your application then the solution would be to NOT use UIWebView. You cannot simply "restart" or "reset" your application. If performance is decreasing over time as your app is being used then this suggests that you might not be managing your memory or object allocations properly. You can use the Leaks instrument to debug your application and try to hunt down memory leaks and you can use the Allocations instrument to analyze your object allocations.
I have an XNA application that communicates with another process (on the same computer) using WCF.
On each Update cycle, the XNA will get data from the other process.
The XNA runs fine when in a window (over 60fps),
but if I try to run it fullscreen, I'm getting less than 1fps.
This does not happen if I turn off the WCF.
Why would fullscreen affect it like that ?
Any ideas ?
Thanks.
This seems like a long shot, providing that there's not much details, but it looks to me you have some thread starvation issues, possibly caused by page flip / buffer swap waiting for something? (What OS are you using, how many cores)
You should try using the profiler and analyzing the code to see where is the critical secion.
For a quick fix, try using Thread.Sleep(1), or switching to Async calls for your WCF service.
It seems whenever I go to use the debugger in my project xcode decides to get caught and shows the pinwheel indefinitely. (haven't waited more than 5 minutes.) The strange thing is that this is only happening with one of my projects, the other ones are working fine. I can mouse over a variable and it will give me the information and everything, but in my one application, not such luck.
Is there a programming error that would cause such an issue? Or is there a possible solution to this problem? Thanks in advance for any help!
It sounds like there might be an infinite loop somewhere... Otherwise I have no clue. Try rebooting your Mac. Try simulator versus device.
I honestly have no clue what the problem was, it stopped doing it all of a sudden, then I did an update to xcode and it has not done it since. It probably just caught a hitch somewhere. whatever. Thanks for your help!