I need to create one View or ImageView, which can be remotely updated from a computer without major App Store Update. So basically, it needs to be able to be changeable through the internet browser or command line tool. So for example today I can have one picture, and in some days i can remotely change it. Is there code I need to implement or is there a service that can help me in that? Thanks a lot folks!
That's the code so far:
#import "ViewController.h"
@interface ViewController ()
@property (strong, nonatomic) IBOutlet UIImageView *imageView;
@end
@implementation ViewController
- (void) viewDidLoad
{
[super viewDidLoad];
//do stuff here
if(&UIApplicationWillEnterForegroundNotification) { //needed to run on older devices, otherwise you'll get EXC_BAD_ACCESS
NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter];
[notificationCenter addObserver:self selector:@selector(enteredForeground:) name:UIApplicationWillEnterForegroundNotification object:nil];
}
}
- (void)enteredForeground:(NSNotification*) not
{
UIImageView *imageView; // Assumed to already be setup in a view controller
PFQuery *query = [PFQuery queryWithClassName:@"Image"];
[query getObjectInBackgroundWithId:@"nMW24stvhT" block:^(PFObject *imageObject, NSError *error) {
if (!error) {
PFFile *imageFile = imageObject[@"image"];
[imageFile getDataInBackgroundWithBlock:^(NSData *data, NSError *error) {
if (!error && data) {
UIImage *image = [UIImage imageWithData:data];
if (image) {
imageView.image = image;
}
}
}];
}
}];}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end