Unfortunately, there is not much you as a buyer can do to ensure that the apartment complex gets an Occupancy Certificate. It is the builders prerogative to construct the apartment complex as per the approved building plan and following the building bye-laws. Only when the builder has adhered to all the rules in entirety will the government issue an Occupancy Certificate for the project.
What you can and should do is to get the help of an independent civil engineering professional who can verify if the construction is done as per norms defined by the Government. He/She will be able to tell you in advance, based on their assessment, whether the apartment complex will get an OC or not.
Additionally, you should also incorporate a clause in your Sale Agreement that if the apartment does not get an OC you can Cancel your booking and get your money back in full.