[Apple Store]restrict the locations

This is the forum for miscellaneous technical/programming questions.

Moderator: 2ffat

[Apple Store]restrict the locations

Postby Lena » Fri Nov 09, 2018 12:43 am

Hello.
A mobile application has been created for one of the pharmacies in the city of Denver USA. In addition to medical products, marijuana is sold there it is officially authorized. In the developer’s console apple I dropped all countries and left only the USA and Canada. In Canada official sale of marijuana is also permitted.
However, when I try to publish the application I get a refusal:
Guideline 1.4.3 - Safety - Physical Harm
Your app offers medicinal or recreational marijuana dispensary information, which is not legal in all of the locations where your app is available.
Next Steps
Please revise your app to restrict the locations where your app can be used.


I read this: CoreLocation
But I did not understand how to implement Next Steps on FMX for USA and Canada. Please tell me how to.
Lena
BCBJ Master
BCBJ Master
 
Posts: 585
Joined: Sun Feb 06, 2011 1:28 pm

Re: [Apple Store]restrict the locations

Postby rlebeau » Fri Nov 09, 2018 12:58 pm

You are probably getting rejected because marijuana is not legalized in the entire USA, a few states still have not legalized it yet even for medical use (whereas marijuana is legal for both recreation and medicine in the entire Canada). So, limiting your app to the USA as a whole is likely a bit too broad for Apple's guidelines.
Remy Lebeau (TeamB)
Lebeau Software
User avatar
rlebeau
BCBJ Author
BCBJ Author
 
Posts: 1547
Joined: Wed Jun 01, 2005 3:21 am
Location: California, USA

Re: [Apple Store]restrict the locations

Postby Lena » Mon Nov 12, 2018 2:19 am

Hi.
How to perform Next Steps?:
Guideline 1.4.3 - Safety - Physical Harm
Your app offers medicinal or recreational marijuana dispensary information, which is not legal in all of the locations where your app is available.
Next Steps
Please revise your app to restrict the locations where your app can be used.
Resources
For information on location awareness options, please review the https://developer.apple.com/library/arc ... ction.html available in the iOS Developer Center.
If you are interested in implementing geo-blocking, please review https://developer.apple.com/library/arc ... ation.html



How to determine if an application is running in Colorado? If not, disable launch.
FMX TGeocoder AdminArea? how to use?
Last edited by Lena on Tue Nov 13, 2018 3:00 am, edited 1 time in total.
Lena
BCBJ Master
BCBJ Master
 
Posts: 585
Joined: Sun Feb 06, 2011 1:28 pm

Re: [Apple Store]restrict the locations

Postby rlebeau » Mon Nov 12, 2018 11:56 am

Lena wrote:What now? How to perform Next Steps?


I don't have an answer for that.
Remy Lebeau (TeamB)
Lebeau Software
User avatar
rlebeau
BCBJ Author
BCBJ Author
 
Posts: 1547
Joined: Wed Jun 01, 2005 3:21 am
Location: California, USA

Re: [Apple Store]restrict the locations

Postby Lena » Thu Nov 15, 2018 12:59 am

Hi, rlebeau.
Help please find the problem in my code.
All breakpoints are normal.
However, the event OnGeocodeReverseEvent is not executed.
Code: Select all
//h file
#include <System.Sensors.Components.hpp>
#include <System.Sensors.hpp>
//---------------------------------------------------------------------------
class TForm1 : public TForm
{
__published:   // IDE-managed Components
   TLocationSensor *LocationSensor1;
   TLabel *Label1;
   TLabel *Label2;
   TButton *Button1;
   TMemo *Memo1;
   TEdit *Edit1;
   TEdit *Edit2;
   TCheckBox *CheckBox1;
   void __fastcall LocationSensor1LocationChanged(TObject *Sender, const TLocationCoord2D &OldLocation,
        const TLocationCoord2D &NewLocation);
   void __fastcall FormShow(TObject *Sender);
private:   // User declarations
    TGeocoder *fGeocoder;
public:      // User declarations
   __fastcall TForm1(TComponent* Owner);
   void __fastcall OnGeocodeReverseEvent(TCivicAddress* const Address);
};


Code: Select all
//cpp
//---------------------------------------------------------------------------

#include <fmx.h>
#pragma hdrstop

#include "geo.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.fmx"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
   : TForm(Owner)
{
 LocationSensor1->Active=true;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::LocationSensor1LocationChanged(TObject *Sender, const TLocationCoord2D &OldLocation,
        const TLocationCoord2D &NewLocation)
{
   if (CheckBox1->IsChecked == true)
   {
     Edit1->Text = NewLocation.Latitude;
     Edit2->Text = NewLocation.Longitude;
   }

   try
    {
     if(fGeocoder == NULL)
      {
       if(TGeocoder::Current != NULL)
         {
         fGeocoder = (TGeocoder*)new TGeocoderClass(TGeocoder::Current);
           }

       if(fGeocoder != NULL)
         {
         fGeocoder->OnGeocodeReverse = OnGeocodeReverseEvent;// breakpoint OK
           }

      }

     if((fGeocoder != NULL) && (fGeocoder->Geocoding()))
       {
        fGeocoder->GeocodeReverse(NewLocation);
         }

    }
    catch (const Exception &E)
        {
         String MES =  E.Message;
         ShowMessage(L"Error: " + MES);
        }


}
//---------------------------------------------------------------------------
void __fastcall TForm1::FormShow(TObject *Sender)
{
   CheckBox1->IsChecked=true;
}
//---------------------------------------------------------------------------
 void __fastcall TForm1::OnGeocodeReverseEvent(TCivicAddress* const Address)
 {
    if (Address!= NULL)
    {
      Memo1->Lines->Add(Address->CountryName);
      Memo1->Lines->Add(Address->AdminArea);
    }
    /*
    if((Address->CountryName != "USA") &&(Address->AdminArea != "Colorado"))
    {
      ShowMessage(L"This app only for Colorado.");
      LocationSensor1->Active = false;
      Application->Terminate();
     }
     */
 }
Lena
BCBJ Master
BCBJ Master
 
Posts: 585
Joined: Sun Feb 06, 2011 1:28 pm

Re: [Apple Store]restrict the locations

Postby rlebeau » Fri Nov 16, 2018 3:52 pm

Lena wrote:However, the event OnGeocodeReverseEvent is not executed.


That is probably because you are not actually calling GeocodeReverse() to perform a lookup, so there is no result to report. There is a bug in your code logic:

Code: Select all
if((fGeocoder != NULL) && (fGeocoder->Geocoding())) // <-- BUG!
    {
    fGeocoder->GeocodeReverse(NewLocation);
    }


It should look like this instead:

Code: Select all
if((fGeocoder != NULL) && (!fGeocoder->Geocoding())) // <-- FIXED
    {
    fGeocoder->GeocodeReverse(NewLocation);
    }


Notice the '!' operator when checking the result of Geocoding(). You want to call GeocodeReverse() when the Geocoder is NOT busy performing a reverse lookup.

Also, there is another bug in your code. In your OnGeocodeReverse handler, in the commented out code, you are using the '&&' operator where you should be using the '||' operator instead:

Code: Select all
if((Address->CountryName != "USA") &&(Address->AdminArea != "Colorado")) // <-- WRONG


If the location is within the USA, but anywhere other than Colorado, your app will not exit correctly. It will only exit if the location is not in the USA at all. You want the app to exit if the location is anywhere other than Colorado USA:

Code: Select all
if((Address->CountryName != "USA") || (Address->AdminArea != "Colorado")) // <-- FIXED


Alternatively, if you want to use '&&', you need to do this instead:

Code: Select all
if(!((Address->CountryName == "USA") && (Address->AdminArea == "Colorado")))
Remy Lebeau (TeamB)
Lebeau Software
User avatar
rlebeau
BCBJ Author
BCBJ Author
 
Posts: 1547
Joined: Wed Jun 01, 2005 3:21 am
Location: California, USA

Re: [Apple Store]restrict the locations

Postby Lena » Sat Nov 17, 2018 5:03 am

Thank You rlebeau very much! Everything works perfectly!

P.S.
My problem now is that I am in Ukraine and I don’t yet know how to change my new test code to see in Memo state of Colorado.
//Denver Colorado on google map: 39.739170, -104.984720
NewLocation.Latitude = 39.739170;
[bcciosarm64 Error] geo.cpp(25): read-only variable is not assignable

It is possible to see the force Сolorado in Memo if I'm in Ukraine? :)
I do not know what to write correctly in the operator Address->AdminArea ==
1. Colorado
2. State of Colorado
3. Colorado State
4. Colorado State of USA
etc.

May be it the best way:
Code: Select all
String s = Address->AdminArea;
int p = s.Pos("Colorado");
if(p>0)
  {
  //user in Сolorado
  //***
  }
  else
    {
     ShowMessage(L"This app only for Colorado.");
     LocationSensor1->Active = false;
     Application->Terminate();//is it correct for IOS?
    }

?
Lena
BCBJ Master
BCBJ Master
 
Posts: 585
Joined: Sun Feb 06, 2011 1:28 pm


Return to Technical

Who is online

Users browsing this forum: Bing [Bot] and 11 guests