Я искал ответ в Интернете и нашел довольно много решений, но должен признать, что я не совсем понимаю, как я новичок, как применить ответ, один пример: UIDevice uniqueIdentifier Устаревший - Что теперь делать?
Я был бы очень признателен, если бы кто-нибудь показал мне пример того, как применить решение к проблеме, в приведенном ниже коде, поскольку следующая строка устарела (uniqueIdentifier), строка кода взята из Cocos2d CLScoreServerRequest.m, но появляется в также несколько других:
device = [[UIDevice currentDevice] uniqueIdentifier];
Функция выглядит так:
-(BOOL) requestScores:(tQueryType)type
limit:(int)limit
offset:(int)offset
flags:(tQueryFlags)flags
category:(NSString*)category
{
// create the request
[receivedData setLength:0];
// it's not a call for rank
reqRankOnly = NO;
NSString *device = @"";
if( flags & kQueryFlagByDevice )
device = [[UIDevice currentDevice] uniqueIdentifier];
// arguments:
// query: type of query
// limit: how many scores are being requested. Default is 25. Maximun is 100
// offset: offset of the scores
// flags: bring only country scores, world scores, etc.
// category: string user defined string used to filter
NSString *url= [NSString stringWithFormat:@"%@?gamename=%@&querytype=%d&offset=%d&limit=%d&flags=%d&category=%@&device=%@",
SCORE_SERVER_REQUEST_URL,
gameName,
type,
offset,
limit,
flags,
[category stringByAddingPercentEscapesUsingEncoding: NSUTF8StringEncoding],
device
];
// NSLog(@"%@", url);
NSURLRequest *request=[NSURLRequest requestWithURL:[NSURL URLWithString:url]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
// create the connection with the request
// and start loading the data
self.connection=[NSURLConnection connectionWithRequest:request delegate:self];
if (! connection_)
return NO;
return YES;
}