Gamecenter not updating scores at the completion of submit

2017-12-22 Thread Dan S
Hello, I am trying to pull the latest score list from the GameCenter but
once it is submited, it does not comeback right away, but after 3-15
seconds delay (as in it works if I do the fetch on a delay)

Here is sample of what I do doring submition/fetching, and wonder if this
is just while in testflight or if there is a proper way of doing this?:

[GKScore reportScores:scores withCompletionHandler:^(NSError *error) {
if(!error) {
...
// put break point here and wait 20 seconds, the score is
returned...
// if you don't break and wait here, the old (previouse) score is
returned instead
[leaderboardRequest loadScoresWithCompletionHandler: ^(NSArray
*scores, NSError *error) {
if(!error) {
// do something with the score here
}
}];
}
}];
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Data, enumerateBytes: separate blocks?

2017-12-22 Thread Quincey Morris
On Dec 22, 2017, at 08:48 , Daryle Walker  wrote:
> 
> DispatchData would need to be convertible to Data.  Is there a way to do the 
> conversion in Swift?

Actually, on consideration, I think not. It would be if DispatchData was 
bridgeable like Data, but it isn’t, and I don’t see any way of extracting its 
underlying reference. This leaves you with two options that I can see:

1. Use an Obj-C helper function, taking an array of input buffers, and 
returning a dispatch_data_t object that combines them, cast to a NSData*. You 
can then use the returned reference as Data.

2. Move your Data extension to DispatchData. That’s what I was asking about 
earlier — is there any reason why you couldn’t just use DispatchData rather 
than Data, in all the code that deals with this data set? In that case, you can 
just build the DispatchData in Swift.

IAC, you should probably submit a bug report. Since dispatch_data_t is 
documented to be a subclass of NSData, there should probably be a mechanism for 
getting Data and DispatchData values as equivalents of each other, without any 
unprovoked copying of the underlying data.

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Data, enumerateBytes: separate blocks?

2017-12-22 Thread Daryle Walker
> On Dec 21, 2017, at 11:10 PM, Quincey Morris 
>  wrote:
> 
> On Dec 21, 2017, at 18:04 , Daryle Walker  > wrote:
>> 
>> when multiple blocks are used
> 
> At this point, I don’t understand what you don’t understand. Here’s a code 
> fragment that works in a playground:
> 
>> import Foundation
>> 
>> let buffer1: [UInt8] = [1,2]
>> let buffer2: [UInt8] = [3,4,5,6]
>> 
>> var data = DispatchData.empty
>> data.append (buffer1.withUnsafeBytes { DispatchData (bytesNoCopy: $0) })
>> data.append (buffer2.withUnsafeBytes { DispatchData (bytesNoCopy: $0) })
>> 
>> print (data.count)
>> data.enumerateBytes {
>>  bytes, index, stop in
>>  print (bytes.count, index, bytes [0])
>> }
> 
> producing this output:
> 
>> 6
>> 2 0 1
>> 4 2 3
> 
> Isn’t this what you were asking for: a loop enumerating each of the 
> contiguous portions of a larger data set?

I already have the code as an extension of Data. In C, we can use pointer 
type-punning shenanigans to convert between a dispatch_data_t and NSData*. To 
trigger this code in a test that I would write in Swift, DispatchData would 
need to be convertible to Data.  Is there a way to do the conversion in Swift?  
It doesn’t seem obvious since DispatchData and Data are value types, not 
pointer nor reference types.

I just checked it out with your code above in a playground.  I added an 
extension to Data called “printHello” and called it with a Data object I also 
added.  Sure enough, the DispatchData object could not call that same method.

— 
Daryle Walker
Mac, Internet, and Video Game Junkie
darylew AT mac DOT com 

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com