That line will not give that error, and can in fact always be written as
aa = ASAtomFromString("AA");
since the definition of ASAtomFromString is that it will return the same value each time it is called with the same string value.
The error "expected a dict object" means that you used a method that must have a dictionary (CosDictGet for example) but it wasn't.
To find the failing line use the debugger and (for this small section) single step. The debugger is something you're going to need to use a lot (if you're anything like me).
You can and should also check the return values of your calls to see that they are the type you wish for.