4 Replies
      Latest reply on Mar 13, 2019 1:28 PM by PBK
      ebb123 Level 1 Level 1 (0 points)

        we are trying to add an option to for our app user to update the app whenever there is a new build available on the app store. Can we have tried to look for this option in the help center but did not find any reference to it. Can someone direct us in the right direction on how to accomplish this function?

        • Re: forced update
          KMT Level 9 Level 9 (14,055 points)

          Seen this previous thread?

          https://forums.developer.apple.com/message/329832#329832

           

          Note you may want to move this to the 'App Store' forum...

            • Re: forced update
              ebb123 Level 1 Level 1 (0 points)

              Hello KMT,
              I tried to look at the link you provided but it does not show any instructions/steps on how to accomplish this at the code or setting level.

                • Re: forced update
                  KMT Level 9 Level 9 (14,055 points)

                  There is no simple setting, or lever to pull, that makes that process trivial. That link describes the general process, but it is up to the individual dev to suss the specific code that works with their app.

                   

                  When adopting that process, feel free to come back with specific questions if you need help on code level issues with yours - be sure to show the code that isn't working, etc.

                   

                  Good luck.

              • Re: forced update
                PBK Level 7 Level 7 (3,105 points)

                It's a bit complicated but here's a start:

                 

                You would set up a website.  You could use a free Google 'sites' website.  You would post something on that website like "the current version is 3.2".  In your app you would do something like:

                -(void)checkVersion{
                    NSURLSession *theConnection=[NSURLSession sessionWithConfiguration:
                             [NSURLSessionConfiguration defaultSessionConfiguration] 
                             delegate:self delegateQueue:nil];
                    [[theConnection dataTaskWithURL:
                              [NSURL URLWithString:@"h ttps://sites.google.com/site/mySiteOnGoogleSites"]] resume];
                    if(theConnection) {
                        receivedData = [[NSMutableData alloc] init];
                        [receivedData setLength:0];
                    }
                }
                
                
                -(void)URLSession:(NSURLSession *)session dataTask:(NSURLSessionDataTask *)dataTask didReceiveData:(NSData *)data{
                    [receivedData appendData:data];
                }
                
                
                -(void)URLSession:(NSURLSession *)session task:(NSURLSessionTask *)task didCompleteWithError:(NSError *)error{
                    dispatch_async(dispatch_get_main_queue(), ^{
                        if(!error){
                            BOOL detectedDeviceCode=NO;
                            NSString *temp=[[NSString alloc] initWithData:self->receivedData encoding:NSUTF8StringEncoding];
                    //         NSLog(@"the string is %@",temp2);
                            NSScanner *theScanner = [NSScanner scannerWithString:temp];
                
                
                       // here you parse the website looking for your phrase "the current website is".  
                         //    Check it's value against something stored in your app and if they don't agree issue an alert