Restkit映射 - 工程在模拟器,而不是在iPad(Restkit mapping - Work

2019-10-20 22:36发布

我一直在建设这个项目几个月,在模拟器和iPad这两个测试与像我有现在的一个没有任何问题。 突然间,我再也不能在我的iPad上成功的GET请求映射从我的Rails应用程序的核心数据对象。 我有在模拟器上没有问题。

当应用程序启动,我想提出一个大的GET请求,如果没有在核心数据的任何数据。 这里是(在使用模拟器AKA)的成功案例是什么RestKit日志:

2014-09-12 17:32:38.339 SWit[44986:60b] I restkit.network:RKObjectRequestOperation.m:150 GET 'http://10.0.0.167:3000/score/get_data'
2014-09-12 17:32:40.395 SWit[44986:3713] I restkit.core_data:RKInMemoryManagedObjectCache.m:94 Caching instances of Entity 'Division' by attributes 'divisionID'
2014-09-12 17:32:40.441 SWit[44986:3713] I restkit.core_data:RKInMemoryManagedObjectCache.m:94 Caching instances of Entity 'CompetitionLocation' by attributes 'competitionLocationID'
2014-09-12 17:32:40.718 SWit[44986:3713] I restkit.core_data:RKInMemoryManagedObjectCache.m:94 Caching instances of Entity 'Organization' by attributes 'organizationID'
2014-09-12 17:32:40.725 SWit[44986:3713] I restkit.core_data:RKInMemoryManagedObjectCache.m:94 Caching instances of Entity 'CompetitionGame' by attributes 'competitionGameID'
2014-09-12 17:32:40.769 SWit[44986:3713] I restkit.core_data:RKInMemoryManagedObjectCache.m:94 Caching instances of Entity 'Player' by attributes 'playerID'
2014-09-12 17:32:43.390 SWit[44986:3713] I restkit.core_data:RKInMemoryManagedObjectCache.m:94 Caching instances of Entity 'Team' by attributes 'teamID'
2014-09-12 17:32:43.457 SWit[44986:3713] I restkit.core_data:RKInMemoryManagedObjectCache.m:94 Caching instances of Entity 'Conference' by attributes 'conferenceID'
2014-09-12 17:32:43.489 SWit[44986:3713] I restkit.core_data:RKInMemoryManagedObjectCache.m:94 Caching instances of Entity 'StatisticInput' by attributes 'statisticInputID'
2014-09-12 17:32:43.541 SWit[44986:3713] I restkit.core_data:RKInMemoryManagedObjectCache.m:94 Caching instances of Entity 'Location' by attributes 'locationID'
2014-09-12 17:32:43.658 SWit[44986:3713] I restkit.core_data:RKInMemoryManagedObjectCache.m:94 Caching instances of Entity 'Contest' by attributes 'contestID'
2014-09-12 17:32:43.693 SWit[44986:3713] I restkit.core_data:RKInMemoryManagedObjectCache.m:94 Caching instances of Entity 'League' by attributes 'leagueID'
2014-09-12 17:32:43.778 SWit[44986:3713] I restkit.core_data:RKInMemoryManagedObjectCache.m:94 Caching instances of Entity 'Game' by attributes 'gameID'
2014-09-12 17:32:43.858 SWit[44986:3713] I restkit.core_data:RKInMemoryManagedObjectCache.m:94 Caching instances of Entity 'Season' by attributes 'seasonID'
2014-09-12 17:32:43.912 SWit[44986:3713] I restkit.core_data:RKInMemoryManagedObjectCache.m:94 Caching instances of Entity 'Site' by attributes 'siteID'
2014-09-12 17:32:43.930 SWit[44986:3713] I restkit.core_data:RKInMemoryManagedObjectCache.m:94 Caching instances of Entity 'Sport' by attributes 'sportID'
2014-09-12 17:32:43.960 SWit[44986:3713] I restkit.core_data:RKInMemoryManagedObjectCache.m:94 Caching instances of Entity 'Member' by attributes 'memberID'
2014-09-12 17:32:45.669 SWit[44986:3713] I restkit.core_data:RKInMemoryManagedObjectCache.m:94 Caching instances of Entity 'GameTeam' by attributes 'gameTeamID'
2014-09-12 17:32:45.770 SWit[44986:3713] I restkit.core_data:RKInMemoryManagedObjectCache.m:94 Caching instances of Entity 'CompetitionStatistic' by attributes 'competitionStatisticID'
2014-09-12 17:32:45.803 SWit[44986:3713] I restkit.core_data:RKInMemoryManagedObjectCache.m:94 Caching instances of Entity 'Competition' by attributes 'competitionID'
2014-09-12 17:32:45.848 SWit[44986:3713] I restkit.core_data:RKInMemoryManagedObjectCache.m:94 Caching instances of Entity 'User' by attributes 'userID'
2014-09-12 17:32:46.694 SWit[44986:3713] I restkit.core_data:RKInMemoryManagedObjectCache.m:94 Caching instances of Entity 'CompetitionContest' by attributes 'competitionContestID'
2014-09-12 17:32:48.845 SWit[44986:6003] I restkit.network:RKObjectRequestOperation.m:220 GET 'http://10.0.0.167:3000/score/get_data' (200 OK / 7329 objects) [request=1.9976s mapping=8.5074s total=10.6074s]
2014-09-12 17:32:48.846 SWit[44986:60b] I app:GamesViewController.m:204 Load complete: Table should refresh...

当我尝试在我的iPad,RestKit记录进行CompetitionContest线(3日从底部)的一切,但当时它只是坐在和无限期地认为。 iPad上的核心数据库中有0行的所有实体。 这里是启动GET请求的代码:

[self.manager 
getObjectsAtPathForRouteNamed:@"get_data"                              
object:nil                           
parameters:nil                                      
success:^(RKObjectRequestOperation *operation, RKMappingResult *mappingResult)
{
    RKLogInfo(@"Load complete: Table should refresh...");
     [self fetchCompetitions]; //method that makes a fetch request to core data to populate self.competitions
     if (self.competitions == nil || self.competitions.count == 0)
     {
         UIAlertView *noGamesScheduled = [[UIAlertView alloc] initWithTitle:@"Error!" message:@"Insert alert message here." delegate:self cancelButtonTitle:@"OK" otherButtonTitles: nil];
         [noGamesScheduled show];
     }
     else
     {
         [self.collectionView reloadData];
     }
 }

failure:^(RKObjectRequestOperation *operation, NSError *error)
{
    RKLogError(@"Load failed with error: %@", error);
}];

我的映射和一切都因为它的工作在模拟器上就好了要罚款。 什么是模拟器和我的iPad之间的区别!?!

文章来源: Restkit mapping - Works in simulator, not on iPad