I did everything according to documentation.i marked both the Apple WorldWide Developer certificate as always trusted..
and the iPhone Distribution one as Always trusted
CSSMERR_TP_NOT_TRUSTED build error (and sometimes but less common, is it's Archive 'Share' or 'Submit' manifestation) is the result of mistakenly modifying Trust Settings on one of your iOS Development-related certificates. The resolution is slightly different than simply needing to install the Apple WWDR Intermediate Certificate, as suggested by pixel.
Fixing the build error can be as simple as restoring the Trust Settings to "Use System Defaults" for the certificate exhibiting the Blue Circle With White Plus Sign in the header pane of Keychain Access, but can be as rigorous as requiring you to remove all copies of your iOS Development-related certificates from all Keychains, and then restore the certificates once again. One copy of each certificate type in the default keychain - typically the login keychain - will do.
See Apple's publication for the full steps to resolving this error "How do I resolve the CodeSign error: CSSMERR_TP_NOT_TRUSTED?".