Is it possible to relauches an ipad application? - objective-c

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.

Related

Why do extensions/WebView impact performance so much? and how to prevent?

I am currently using the SVG map extension and I am noticing that whenever I turn on the WebView my Qlikview file suddenly doesn't react as fast as it used to. The difference is quite large, sometimes it makes everything 2 to 3 times slower compared to when I turn WebView off.
What is the cause of this and is there any way I can prevent this? Is it because of the SVG map extension and should I just use a different one (open to suggestions!)? Or is it because of WebView?
It's also good to know that my Qlikview document isn't all too complex/large (just some charts/donuts etc.) and runs great without the extension/WebView
Thanks in advance,
CvP
This is just a theory, when you turn web view on there is a web browser that renders the objects on screen which means that everything must be translated to web code.
During "normal" mode everything is rendered by qlik's engine and it is probably optimized for speed.

Windows 8 Metro/Immersive App - Force Terminate

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.

Why does my app always open with a memory warning, if there is almost no code for the first view?

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).

Check memory consume of vb.net application

I am getting a System.OutOfMemoryException from my vb.net application, it happened from one certain user. I am trying to figure out whether my application takes too much memory space or the PC has low memory. But she just upgraded her desktop as i3 Intel CPU and higher memory.
Is there any tool that I check memory consumption when code is executed as go through lines?
By the way, it is developed by vs2010 and It is a Windows application.
<--Edit-->
I found the problem from my application. I did not mention because I did not know what the problem was. I am using a Google map inside of vb.net application. It takes a memory whenever I search a map on web browser which is on a form . Even though I close the form, it is not disappeared from
memory. It is just going up. That goes away when I close MDI form. FYI..
The best tool we've worked so far is the JetBrains profiler (http://www.jetbrains.com/profiler/features/).
That's a common error. It normally happens when the application enters a loop that never ends... (infinite loop).
Is it a Console, WinForms, ASP, WPF?
Try to identify during which Event your application throws the exception and put a try catch to print out more details.
Just check out this cool WPF performance suite to check out if you have memory leaks:
Performance Toolkit
Or check out if you can use GC.Collect() to find the leak.
Also you can accecss in Process Explorer to any .Net memory data and peaks.
Regards

What can cause a UIView to be arbitrarily removed from the hierarchy?

I have an iPhone app that, for some users, sometimes behaves as if with the main UIView has been removed from the view hierarchy. It always happens coincident with a significant event in the game. Other Core Graphics-drawn UIViews that are above it in the z-order remain, but the main one (an OpenGL view) appears to be gone, leaving the background (a solid color).
The app does not crash (it keeps running, without the view), and this seems to happen very consistently for affected users. Unfortunately I am not able to reproduce it.
I suspect a memory issue -- that would be the easiest explanation -- but based on my reading it looks like didReceiveMemoryWarning only deallocs views that aren't visible, and aside from that the memory usage for my app is pretty small. Also, the "significant event" only results in OpenGL drawing and a SoundEngine call -- no view manipulation.
Anybody out there seen something like this before?
Yes, infact one of my applications very occasionally exhibits this problem and it does seem to be memory related.
I have had no success tracking it down either by debugging or analyzing the program flow. I have verified that the view in question is destroyed and not just hidden in some way.
It happens so infrequently that I haven't looked into it to deeply, but I do think it's caused by something in the OS in some way,
You can easily test low memory in the simulator to debug this problem if it is memory related.
The problem ended up being an uncaught NSException (from a third party library) thrown in the app's timer thread, which killed the timer thread but not the rest of the app. The good news is that crash reports are generated in this case, which can make tracking it down much easier if you know to look/ask for them.
As is made clear in the SDK documentation, when your app is running low on memory, views that are not in use can be collected. When it's needed again, it's re-created. This is to conserve precious iPhone resources. Your best bet is to retain the view so it can't be released.