What did you have sprayed? Was it the joists or the rafters? If it was the rafters and the gable end walls, then your vents have been blocked so the attic is now inside the conditioned envelope and that means the outgas has no where to go. Do you have windows in the gable end walls, if so, open them to allow the attic to be vented.
What kind (brand) of foam did you use? Some will outgas for years, but the most of the outgassing occurs with in the first few days.