Using the loop rule while charging circuits We know that in an LC circuit the voltage across the capacitor is the same as the voltage across the inductor (the emf induced in it). This is a direct conclusion of KVL (Kirchoff's Loop Rule) applied to the circuit. But can we use KVL in such circuits, where we have things like capacitors and inductors which affect the voltages and current?
For example, in a circuit with a battery and a capacitor, KVL cannot be applied. In fact, the voltages and current asymptotically approach the values predicted by KVL as the capacitor charges. 
Similarly, while deriving the time-dependence of current in an ac circuit with a capacitive load, the argument commonly presented is as follows:
Voltage of source = Voltage across capacitor 
$$V_{cap}(t) = V_0\sin(\omega t)$$
$$Q_{cap} = CV_{cap}(t)$$
$$i = \frac{d(CV_{cap}(t))}{dt} = C\frac{d(V_0\sin(\omega t))}{dt} = CV_0\omega\cos(\omega t)$$
thus concluding that the current and emf are phase shifted by $\pi/2$. But isn't there a flaw if we use KVL in such circuits?
 A: 
For example, in a circuit with a battery and a capacitor, KVL cannot
  be applied.

Yes, in fact, it can.

In fact, the voltages and current asymptotically approach the values
  predicted by KVL as the capacitor charges.

Then there is more than just a capacitor and battery in the circuit.
First, to be clear, KVL is an approximation that is exact in the limit of ideal circuit theory.
Now, KVL applied to an ideal circuit composed of a battery and capacitor yields the following equation:
$$v_C = V_{BAT}$$
So there is no time dependence; at all times the capacitor voltage and (constant) battery voltage are equal.
For a physical circuit composed of a physical battery and capacitor, one must not forget to include additional ideal circuit elements to model the non-ideal characteristics of physical circuit elements.
For example, if we assume the circuit has not existed forever, there must be a switch to model the fact that, at some time, the capacitor is connected to the battery.
Also, a physical battery cannot supply arbitrarily large current and, in fact, can only supply a finite current when short-circuited.  Thus, we must at least add an ideal resistor in series with the ideal battery to approximate a physical battery.
Since the physical wires connecting the battery and capacitor have non-zero resistance, this resistance may need to be modelled too.
In some cases, we may need to model the non-zero inductance of the wires etc. but, let's assume that we can safely ignore that and any other non-ideal characteristics for this particular problem.
Now, the KVL equation for this ideal circuit model of a physical battery-capacitor circuit is (when the switch is closed):
$$v_C = V_{BAT} - i(R_{BAT} + R_{WIRE})$$
Taking the time derivative of both sides and multiplying by the capacitance C yields:
$$C\frac{dv_C}{dt} = i = -\frac{di}{dt}(R_{BAT} + R_{WIRE})C$$
for which the solution is
$$i = i_0e^{-t/\tau} $$
where
$$\tau = (R_{BAT} + R_{WIRE})C$$
and
$$i_0 = \frac{V_{BAT}}{R_{BAT} + R_{WIRE}} $$
is the current immediately after the switch is closed at $t = 0$.
Thus,
$$v_C = V_{BAT} -  i_0(R_{BAT} + R_{WIRE})e^{-t/\tau} = V_{BAT}(1 - e^{-t/\tau}), \, t\ge 0$$
So, in fact, KVL does give the correct equation predicting the capacitor voltage.
