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 7089283
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T07:54:11+00:00 2026-05-28T07:54:11+00:00

After making the rest call through RKObjectManager,it is not loading the objects when i

  • 0

After making the rest call through RKObjectManager,it is not loading the objects when i don’t have internet connection. I test with domain.local and my WIFI is Off.

I know that i can implement with “reachabilityObserver” but i don’t know how can i make this.

My code :

#import "ViewInformationForm.h"
#import <RestKit/RestKit.h>

@interface User : NSObject {
    NSNumber*        _user_forfait;
    NSNumber*        _user_client_free;
    NSNumber*        _user_demande_portabilite;
    NSNumber*        _user_mail_confirm;
    NSNumber*        _user_mail_enregistrement_inscrption;
    NSNumber*        _user_mail_depart_expedition;
    NSNumber*        _user_mail_arrivee_expedition;
    NSNumber*        _user_activation;
    NSNumber*        _user_portabilite;
}

@property (nonatomic, retain) NSNumber*        user_forfait;
@property (nonatomic, retain) NSNumber*        user_client_free;
@property (nonatomic, retain) NSNumber*        user_demande_portabilite;
@property (nonatomic, retain) NSNumber*        user_mail_confirm;
@property (nonatomic, retain) NSNumber*        user_mail_enregistrement_inscrption;
@property (nonatomic, retain) NSNumber*        user_mail_depart_expedition;
@property (nonatomic, retain) NSNumber*        user_mail_arrivee_expedition;
@property (nonatomic, retain) NSNumber*        user_activation;
@property (nonatomic, retain) NSNumber*        user_portabilite;

@end

@implementation User

@synthesize user_forfait = _user_forfait;
@synthesize user_client_free = _user_client_free;
@synthesize user_demande_portabilite = _user_demande_portabilite;
@synthesize user_mail_confirm = _user_mail_confirm;
@synthesize user_mail_enregistrement_inscrption = _user_mail_enregistrement_inscrption;
@synthesize user_mail_depart_expedition = _user_mail_depart_expedition;
@synthesize user_mail_arrivee_expedition = _user_mail_arrivee_expedition;
@synthesize user_activation = _user_activation;
@synthesize user_portabilite = _user_portabilite;

@end


@implementation ViewInformationForm;
@synthesize picker,pickerDate, forfaitNames;
@synthesize forfaitText, TextDateEnregistrement;


- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}
- (void)LoadData {


    RKObjectMapping* mapping = [RKObjectMapping mappingForClass:[User class]];
    [mapping mapKeyPathsToAttributes:
     @"data.user_forfait", @"user_forfait",
     @"data.user_client_free", @"user_client_free",
     @"data.user_demande_portabilite", @"user_demande_portabilite",
     @"data.user_mail_confirm", @"user_mail_confirm",
     @"data.user_mail_enregistrement_inscrption", @"user_mail_enregistrement_inscrption",
     @"data.user_mail_depart_expedition", @"user_mail_depart_expedition",
     @"data.user_mail_arrivee_expedition", @"user_mail_arrivee_expedition",
     @"data.user_activation", @"user_activation",
     @"data.user_portabilite", @"user_portabilite",
     nil];

    RKObjectManager *objectManager = [RKObjectManager sharedManager];


    NSString* urlUID = [NSString stringWithFormat:@"/user/data?uid=%@",uuid];
    RKObjectLoader *objectLoader = [objectManager objectLoaderWithResourcePath:urlUID delegate:self];
    objectLoader.method = RKRequestMethodGET;
    objectLoader.objectMapping = mapping;
    [objectLoader send];

}


- (void)objectLoader:(RKObjectLoader*)objectLoader didLoadObjects:(NSArray*)objects {
    User* user = [objects objectAtIndex:0];

    NSString* info = [NSString stringWithFormat:
                      @"\n user_forfait : %@ \n"
                      @"user_client_free : %@",[user user_forfait], [user user_client_free]];
    NSLog(@"%@",info);
}

- (void)objectLoader:(RKObjectLoader *)objectLoader didFailWithError:(NSError *)error {
    RKLogError(@"Load of RKRequest %@ failed with error: %@", objectLoader, error);                      
}

- (void)didReceiveMemoryWarning
{
    // Releases the view if it doesn't have a superview.
    [super didReceiveMemoryWarning];

    // Release any cached data, images, etc that aren't in use.
}

#pragma mark - View lifecycle

/*
// Implement loadView to create a view hierarchy programmatically, without using a nib.
- (void)loadView
{
}
*/


// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad
{
    [RKObjectManager objectManagerWithBaseURL:gRKCatalogBaseURL];



    [self LoadData];
    [super viewDidLoad];
    self.forfaitNames = [[NSArray alloc] initWithObjects:
                         @"-- Sélectionnez un forfait --", @"Forfait 19,99 €", @"Forfait 15,90 €", @"Forfait 2 €",
                         @"Forfait 0 €", nil];
}

Error :

2012-01-24 09:59:32.120 Free M. Stats[13438:10703] I restkit:RKLog.m:30 RestKit initialized...
2012-01-24 09:59:32.127 Free M. Stats[13438:10703] I restkit.network.reachability:RKReachabilityObserver.m:369 Network availability has been determined for reachability observer <RKReachabilityObserver: 0x8987300 host=0.0.0.0 isReachabilityDetermined=YES isMonitoringLocalWiFi=652464 reachabilityFlags=-R tc----->
2012-01-24 09:59:32.129 Free M. Stats[13438:10703] E restkit.network:RKRequest.m:464 Failed to send request to http://freemobile-stats.local/user/data?uid=b070b4f0a581cf1a16312b7bbb31353c due to unreachable network. Reachability observer = <RKReachabilityObserver: 0x8987300 host=0.0.0.0 isReachabilityDetermined=YES isMonitoringLocalWiFi=652464 reachabilityFlags=-R tc----->
2012-01-24 09:59:32.130 Free M. Stats[13438:10703] E app:ViewInformationForm.m:102 Load of RKRequest <RKObjectLoader: 0x6e69050> failed with error: Error Domain=org.restkit.RestKit.ErrorDomain Code=2 "The client is unable to contact the resource at http://freemobile-stats.local/user/data?uid=b070b4f0a581cf1a16312b7bbb31353c" UserInfo=0x6c99270 {NSLocalizedDescription=The client is unable to contact the resource at http://freemobile-stats.local/user/data?uid=b070b4f0a581cf1a16312b7bbb31353c}

Thank you for your help.
AO.

  • 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-05-28T07:54:11+00:00Added an answer on May 28, 2026 at 7:54 am

    This is how you register for the reachability notifications in RestKit:

    // Register for changes in network availability
    NSNotificationCenter* center = [NSNotificationCenter defaultCenter];
    [center addObserver:self selector:@selector(reachabilityDidChange:) name:RKReachabilityDidChangeNotification object:nil];
    

    And here you catch the notification:

    - (void)reachabilityDidChange:(NSNotification *)notification {
        RKReachabilityObserver* observer = (RKReachabilityObserver *) [notification object];
        RKReachabilityNetworkStatus status = [observer networkStatus];
        if (RKReachabilityNotReachable == status) {
            RKLogInfo(@"No network access!");
        } else if (RKReachabilityReachableViaWiFi == status) {
            RKLogInfo(@"Online via WiFi!");
        } else if (RKReachabilityReachableViaWWAN == status) {
            RKLogInfo(@"Online via Edge or 3G!");
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a small problem. After making a hex mask, I can not copy/paste
I have realised after making about 20 tables that I need to user utf8_unicode
After making any change on controllers I have to rebuild for the changes to
After making some changes to a method, I find it utterly annoying to have
Is it possible to interact with an XML file after making a $.ajax() call?
After making some changes in my models (eg. new field in a model and
After making a few modifications to a rails app I am tinkering on, railroad
I am attempting to integrate an existing payment platform into my webshop. After making
After seeing a previous post Making Applications programmed in .NET languages work on older
Django is making very nice forms after creating a models.py and an admin.py. How

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.