The error "Daily Limit Exceeded" could indicate that the request is not being authenticated properly. Does the service have the correct authorizer object for the signed-in user?
I maybe have valid auth key, because second code below return JSON object of CalendarColors. I think that if the service has no authorizer object, second code also fails. Is it right?
On 11月28日, 午後2:46, Greg Robbins <grobb...@google.com> wrote:
> The error "Daily Limit Exceeded" could indicate that the request is not > being authenticated properly. Does the service have the correct authorizer > object for the signed-in user?
Thank you for your advice. My service has auth object but fails. I can get calendars.list and events.list with same service but colors. Do I have to add some header properties else?
I've hit this same issue, and you, Dice-K, do appear to have solved
it.
You have to use https://code.google.com/apis/console to get an APIKey
for your project. Then, at runtime, you assign to the APIKey property
of the Calendar Service. Once you do that,
will call the callback with the calendar colors. This is kind-of
implied by the documentation that says you use the APIKey when making
requests that don't involve user data, and by the error returned by
the server, which asks you to sign in.
But, it is still confusing that some requests need OAuth signing,
while others require an APIKey.
Once you've got the colors, you can turn a color index into an RGB
triplet (as a NSString) like this:
[[[colors calendar] additionalPropertyForName:@"18"] foreground]
You can get a list of the legal index names using [[colors calendar]
additionalJSONKeys]
That is, a GTLCalendarColors has a set of string-valued property keys
that represent integers, where the value is a
GTLCalendarColorDefinition, which has two properties, foreground, and
background, each of which is a 6 character hex NSString, with a
leading '#'. that represents an R.G.B. triplet.
The sane thing to do is: write a category on GTLCalendarColors that
takes an integer and either kForeground or kBackground, and returns an
NSColor (or UIColor on iOS) else nil.
On Nov 27 2011, 11:30 pm, Dice-K <kgt.dnisi...@gmail.com> wrote:
> Thank you for your advice. My service has auth object but fails.
> I can get calendars.list and events.list with same service but colors.
> Do I have to add some header properties else?
Rather than using fetchObjectWithURL: , this is better and also works (now that I know about the APIKey): GTLServiceCalendar *service = [self serviceCalendar]; GTLQueryCalendar *query = [GTLQueryCalendar queryForColorsGet]; // <-- this [self addTicket:[service executeQuery:query delegate:self