Note that there are some explanatory texts on larger screens.

plurals
  1. POGoogle places API "reference" key crashes iPhone app
    primarykey
    data
    text
    <p>I am somewhat new to objective c and have run into an interesting issue. I use JSON to get search results from google places api which works fine. Once the place is found I want to load a second screen that that displays the details of the business. I plan on doing this by using the places details search through the places API. In order to pass information between the two views I have created a data class to hold the variables.</p> <p>DataClass.h</p> <pre><code>#import &lt;Foundation/Foundation.h&gt; @interface DataClass : NSObject { NSString *Lat; NSString *Long; NSString *barLat; NSString *barLong; NSString *Ref; NSString *barName; } @property(nonatomic,retain)NSString *Lat; @property(nonatomic,retain)NSString *Long; @property(nonatomic,retain)NSString *barLat; @property(nonatomic,retain)NSString *barLong; @property(nonatomic,retain)NSString *Ref; @property(nonatomic,retain)NSString *barName; +(DataClass*)getInstance; @end </code></pre> <p>DataClass.m</p> <pre><code>#import "DataClass.h" @implementation DataClass @synthesize Lat; @synthesize Long; @synthesize barLat; @synthesize barLong; @synthesize Ref; @synthesize barName; static DataClass *instance =nil; +(DataClass *)getInstance { @synchronized(self) { if(instance==nil) { instance= [DataClass new]; } } return instance; } @end </code></pre> <p>In my first view I add the reference value like this:</p> <pre><code>DataClass *obj=[DataClass getInstance]; NSString *barRef = [NSString stringWithFormat:@"%@", searchResult.reference]; obj.Ref = barRef; </code></pre> <p>The searchResult.reference is valid and when I put it into barRef and use NSLog it outputs correctly but when I try to add it to the obj object it crashes the app. The string looks like this </p> <p>"CnRrAAAABX_U5FcybhlJgmWGAv19Fhemk_Bu7ytKKuL33201sKfce2aIzeZ2P8cWdKPV8hCsbUbAzYcoA9QDmbMPeYqCX8idypsQH4LXvGwxW_qtW4jBod2bufelyxeLaBlS1DoNfDtaH4evksVluW9gsqCGcRIQkJXwM_RcSewilknJowaghhoUFoR64jZTUDCsrXvmOqg4eqJx5uU"</p> <p>and even if I use </p> <p>NSString *barRef = @"CnRrAAAABX_U5FcybhlJgmWGAv19Fhemk_Bu7ytKKuL33201sKfce2aIzeZ2P8cWdKPV8hCsbUbAzYcoA9QDmbMPeYqCX8idypsQH4LXvGwxW_qtW4jBod2bufelyxeLaBlS1DoNfDtaH4evksVluW9gsqCGcRIQkJXwM_RcSewilknJowaghhoUFoR64jZTUDCsrXvmOqg4eqJx5uU";</p> <p>and then obj.Ref = barRef; it crashes. Any idea why this would be happening or a way to fix it?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload