I want to get feature with attachments, i think fetchData is function asynchronous, so it's always print "fetch data not done" first. So how can i get feature with it attachments? Thanks in advance
You are correct. The fetchData method is async, and so you will see the "fetch data not done" message before the fetchData even makes the request. You need to hold on to each "att", which can probably be done by holding on to each "attachments" array in the same way as you are holding on to the "features" array.
Otherwise, each attachments array returned from "fetchAttachments" will go out of scope at the end of the completion block and be deallocated, and so all the "att" objects will be released before their fetchData calls can complete, and their callbacks will not be entered.
Hope that helps!