Skip to main content
Participating Frequently
November 30, 2012
Answered

CreateDictionary failing

  • November 30, 2012
  • 1 reply
  • 1440 views

Hello all,

While porting my plugin from CS4 to CS6 I ran into a strange problem: I can't seem to create a dictionary reference using the following code (AIDictionarySuite imported at this point).

AIDictionaryRef dref = nil;

AIErr err = sAIDictionary->CreateDictionary(&dref);

After the call, err is equal to 1146045247 and dref is NULL. I shouldn't have to malloc a dictionary ref, right?

My plugin reads and writes to the document's dictionary, and reading seems to be just fine.

Has anyone seen this error code? I can't seem to find reference to it anywhere in the SDK.

For reference:

MacOS X 10.8 / Xcode 4.5.2

Compiling with the 10.6 SDK and Apple LLVM Compiler 4.1

Targeting CS6, 64bit

Thanks in advance!

--josh

This topic has been closed for replies.
Correct answer A. Patterson

Obviously the problem is the SDK doesn't think there's a document open. If you don't, that'll be the end of it If you do have a document open, it may be that you need an application context. DOC? is a common error when the context is missing.

1 reply

Inspiring
November 30, 2012

err is equal to 1146045247


Convert to hex - 444F433F

This is a four character string, lookup in charmap - "DOC?"

Search SDK headers

#define kNoDocumentErr 'DOC?'

A. Patterson
A. PattersonCorrect answer
Inspiring
November 30, 2012

Obviously the problem is the SDK doesn't think there's a document open. If you don't, that'll be the end of it If you do have a document open, it may be that you need an application context. DOC? is a common error when the context is missing.

Participating Frequently
November 30, 2012

Firstly, apologies for not finding the error myself, I guess it was late an I was a bit frustrated. Secondly, thank you very much, I added the AppContext class to my project and now call it before any of my plugin code executes and everything works fine.

Thanks again, this really saved me a ton of time!

--josh