Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7955331
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T03:41:21+00:00 2026-06-04T03:41:21+00:00

I am somewhat new to objective c and have run into an interesting issue.

  • 0

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.

DataClass.h

#import <Foundation/Foundation.h>

@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

DataClass.m

#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

In my first view I add the reference value like this:

DataClass *obj=[DataClass getInstance];  
NSString *barRef = [NSString stringWithFormat:@"%@", searchResult.reference];
obj.Ref = barRef; 

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

“CnRrAAAABX_U5FcybhlJgmWGAv19Fhemk_Bu7ytKKuL33201sKfce2aIzeZ2P8cWdKPV8hCsbUbAzYcoA9QDmbMPeYqCX8idypsQH4LXvGwxW_qtW4jBod2bufelyxeLaBlS1DoNfDtaH4evksVluW9gsqCGcRIQkJXwM_RcSewilknJowaghhoUFoR64jZTUDCsrXvmOqg4eqJx5uU”

and even if I use

NSString *barRef = @”CnRrAAAABX_U5FcybhlJgmWGAv19Fhemk_Bu7ytKKuL33201sKfce2aIzeZ2P8cWdKPV8hCsbUbAzYcoA9QDmbMPeYqCX8idypsQH4LXvGwxW_qtW4jBod2bufelyxeLaBlS1DoNfDtaH4evksVluW9gsqCGcRIQkJXwM_RcSewilknJowaghhoUFoR64jZTUDCsrXvmOqg4eqJx5uU”;

and then obj.Ref = barRef; it crashes. Any idea why this would be happening or a way to fix it?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T03:41:21+00:00Added an answer on June 4, 2026 at 3:41 am

    It seems, your dictionary object is not a dictionary, but string.

    Probable solutions:

    1) Check if you have @”formatted_phone_number” key in your dictionary, using debugger.
    Debug your code and check if your dictionary is nice. You can also use NSLog to output your dictionary content and see, if it is good.

    2) If your dictionary is bad, check if you have something like this. This is how I parse an HTML response from Google API that is in JSON format:

    NSDictionary *dic;
    SBJsonParser *jsonParser = [SBJsonParser new];
    NSError *error = NULL;
    NSURLResponse *response;
    NSHTTPURLResponse *httpResponse;
    
        //Create a URL object.
        NSURL *url = [NSURL URLWithString:urlString];
    
        //URL Request Object
        NSURLRequest *request = [NSURLRequest requestWithURL:url cachePolicy:NSURLCacheStorageAllowed timeoutInterval:userWaitTime];
    
        NSData *data = [NSURLConnection sendSynchronousRequest:request 
                                             returningResponse:&response error:&error];
    
        NSString *htmlString = [[NSString alloc]  initWithBytes:[data bytes]
                                                         length:[data length] encoding: NSUTF8StringEncoding];
    
        //NSLog (@"htmlString: %@", htmlString);
    
        dic = [jsonParser objectWithString:htmlString error:nil];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am somewhat new to R and I have run into a point where
I am somewhat new to JavaScript, and have been having an issue with a
I am somewhat new to transactional databases and have come across an issue I
I am somewhat new to MySQL (come from MS SQL) and have recently come
I am somewhat new to LINQ and have a quick question regarding deleting. Say,
I am somewhat new to R, and i have this piece of code which
I am somewhat new to jQuery and I have a problem with something I
I'm somewhat new to SQL and need help with query syntax. My issue involves
I'm somewhat new to C++, coming from python. One piece of functionality I really
I'm somewhat new to objective-c and I'm not sure what the correct memory management

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.