tags:

views:

206

answers:

2

I would like to retrieve iphone wallpaper system setting and display the system wallpaper into my iphone app as background image. Is it possible or sample code? Thanks in advance.

+1  A: 

AFAIK there are no documented procedures to get the wallpaper image, but you may use these undocumented methods (usual warnings apply):

  • +[UIImage defaultDesktopImage].
  • Read the image at /var/mobile/Library/LockBackground.jpg.
KennyTM
The second method will only work on a jailbroken iPhone
Petesh
@Petesh: Not really, you can access it indirectly by symlink-ing to it.
KennyTM
@KennyTM I did not know that. Consider me educated... goes off and writes test application...
Petesh
@KennyTM I get a NULL file when I try to access the lock background image via a symlink. defaultDesktopImage returns the globe image, not the current desktop image.
Petesh
@Petesh: Hm maybe the sandbox is tightened.
KennyTM
A: 

Thanks a lot, Kenny. Those two approaches can not work properly.

1.[UIImage defaultDesktopImage] can only return the fixed image which is always "Earth" image. If I select other image in the wallpaper folder, it still returns the "Earth" image.

  1. I use UIImage imageWithContentsOfFile method to load @"/var/mobile/Library/LockBackground.jpg" or @"/User/Library/LockBackground.jpg" or @"/User/Library/LockBackground.png" The image is always nil.

Do you know why? Thanks again.

onetoonehundred