1

I know it's not recommended to change any view appearance when the application is moved to background state, but for my specific task I cannot postpone this activity and I really like to complete it in a couple of seconds after the user hits the home button.

That's what I do: I load a webpage in a UIWebView and after loading completion I change the contentOffset and zoomScale in order to make a specific screenshot of that webpage. When the app is in active application state everything works fine.

Now I wanted to add some more multitasking capabilities. I encapsulated the above described webpage loading and rendering activity in a protected background task (iOS Task Completion), in order to complete it even when the user hits the home button.

I have noticed that the page loading and the rendering of the webpage screenshot (with the renderInContext: method) works just fine in background, BUT it seems that the webview (i.e. the encapsulated UIScrollView instance) does not react on setContentOffset: and setZoomScale: messages as soon as the app is in background..

So I'm asking you if you know any alternatives to change the content offset / zoomscale? (modifications directly on CALayer?) Or any method to "force" the scrollview to perform the content changes even in background.

PS: On the iOS simulator everything works fine even in application background state, but on real devices it does not.

EDIT: I have created a simple demo project that demonstrates the issue. You can download it here (please read the instructions in the zip file): http://dl.dropbox.com/u/3556271/BackgroundBugDemo.zip

I appreciate every hint or tip. Thanks!

ersjoh
  • 321
  • 3
  • 13
  • Only use the [tag:objective-c] tag for questions about the language itself. Thanks! – Undo Apr 02 '13 at 13:17
  • http://stackoverflow.com/a/8031912/792677 – A-Live Apr 02 '13 at 13:32
  • @ErwaySoftware Sorry! – ersjoh Apr 03 '13 at 08:24
  • @A-Live I think this does not relate to my question. I've checked that I perform the changes to the webview on the main thread. My problem relates to the fact that the application itself is in background state while performing these changes... – ersjoh Apr 03 '13 at 08:27
  • After consulting Apple DTS, they advised me to open bug report. I've created one (ID 13598083), but I appreciate every workaround to accomplish my desired behavior. – ersjoh Apr 09 '13 at 06:10
  • I have created a simple demo project that demonstrates the issue. You can download it here (please read the instructions in the zip file): https://dl.dropbox.com/u/3556271/BackgroundBugDemo.zip – ersjoh Apr 10 '13 at 12:31

0 Answers0