I am developing iOS app that sending selected pdfs(urls) stored in firebase with using SMTP. I don't want to be seen urls in mail.
It should be like this "https://...." = "Document1 or proper name"
Is it possible ?
func sendEmail() {
let message = SKPSMTPMessage()
message.relayHost = "smtp.gmail.com"
message.login = "****#gmail.com"
message.pass = "*****"
message.requiresAuth = true
message.wantsSecure = true
message.relayPorts = [587]
message.fromEmail = "****#gmail.com"
message.toEmail = "****#gmail.com"
message.subject = "subject"
let messagePart = [kSKPSMTPPartContentTypeKey: "text/plain; charset=UTF-8", kSKPSMTPPartMessageKey: "Hi,\n\n Please see the requested documents below\n\n\(getmailpdf.joined(separator: "\n\n\n"))"]
message.parts = [messagePart]
message.delegate = self
message.send()
}
Related
I'm working on a VPN application, VPN working fine but after 15-20 minutes, its automatically disconnected.
Here is configuration I'm using
let vpnProtocol = NEVPNProtocolIKEv2()
vpnProtocol.username = CredentialsManager.shared.accessToken
vpnProtocol.localIdentifier = CredentialsManager.shared.accessToken
print("VPN Connecting to \(self.region.name ?? "Error! Must be a valid region name!")")
if let region = self.region {
f
vpnProtocol.serverAddress = region.serverAddress
vpnProtocol.remoteIdentifier = region.serverAddress
}
let encodedIdentifier = "Secret Password".data(using: .utf8)!
let item = [kSecClass: kSecClassGenericPassword,
kSecAttrGeneric: encodedIdentifier,
kSecAttrAccount: encodedIdentifier,
kSecMatchLimit: kSecMatchLimitOne,
kSecReturnPersistentRef: kCFBooleanTrue as Any,
kSecAttrService: "XYZ"] as [CFString : Any]
var passwordReference: CFTypeRef?
SecItemCopyMatching(item as CFDictionary, &passwordReference)
vpnProtocol.passwordReference = passwordReference as? Data
vpnProtocol.authenticationMethod = .none
vpnProtocol.useExtendedAuthentication = true
vpnProtocol.ikeSecurityAssociationParameters.encryptionAlgorithm =
.algorithmAES256GCM
vpnProtocol.ikeSecurityAssociationParameters.integrityAlgorithm = .SHA384
vpnProtocol.ikeSecurityAssociationParameters.diffieHellmanGroup = .group14
vpnProtocol.childSecurityAssociationParameters.encryptionAlgorithm = .algorithmAES256GCM
vpnProtocol.childSecurityAssociationParameters.integrityAlgorithm = .SHA384
vpnProtocol.childSecurityAssociationParameters.diffieHellmanGroup = .group14
vpnProtocol.disconnectOnSleep = false
self.vpnManager.protocolConfiguration = vpnProtocol
let connectRule = NEOnDemandRuleConnect()
connectRule.interfaceTypeMatch = .any
self.vpnManager.onDemandRules = [connectRule]
self.vpnManager.isOnDemandEnabled = self.connectOnDemand
self.vpnManager.localizedDescription = "XYZ VPN"
self.vpnManager.isEnabled = true
Please help me out, how to identify problem that causing auto disconnect.
change your VPN protocol with this: NEVPNProtocolIPSec
maybe it will help you.
You have configured "connect on demand", so it will connect back automatically when you will access resource next time. That is how VPN on iOS works, it will always close connection on idle.
I am integrating PayTM in my app which is in ios (Swift) and I am facing issue which title is "Transaction Failed" and the message is "MissingKeys"
I have used following code
merchant = PGMerchantConfiguration.default()!
merchant.checksumGenerationURL = "http://getlook.in/cgi-bin/checksum_generate.cgi"
merchant.checksumValidationURL = "http://getlook.in/cgi-bin/checksum_validate.cgi"
merchant.clientSSLCertPath = nil
merchant.clientSSLCertPassword = nil
merchant.merchantID = "rriver57770575448885"
merchant.website = "APP_STAGING"
merchant.industryID = "Retail"
merchant.channelID = "WAP"
var orderDict = [String: String]()
orderDict["MID"] = "rriver57770575448885" // Merchant ID
orderDict["CHANNEL_ID"] = "WAP" // Channel Id
orderDict["INDUSTRY_TYPE_ID"] = "Retail" // Industry Type
orderDict["WEBSITE"] = "APP_STAGING"
orderDict["TXN_AMOUNT"] = "10"; // amount to charge // mandatory
orderDict["ORDER_ID"] = "\(Date().timeIntervalSince1970)";//change order id every time on new transaction
orderDict["REQUEST_TYPE"] = "DEFAULT";// remain same
orderDict["CUST_ID"] = "123456789027"; // change acc. to your database user/customers
orderDict["MOBILE_NO"] = "8798987874";// optional
orderDict["EMAIL"] = "test#paytm.com"; //optional
let pgOrder = PGOrder(params: orderDict)
let transaction = PGTransactionViewController.init(transactionFor: pgOrder)
transaction?.serverType = eServerTypeProduction
transaction?.merchant = merchant
transaction?.loggingEnabled = true
transaction?.delegate = self
self.present(transaction!, animated: true, completion: nil)
please help!
In this code you have missed a parameter called chechSumHash. include that too.
orderDict["CHECKSUMHASH"] = CheckSum;
checkSumHash can be generated in the backend by the help of Paytm checksum generation kit. the checksum is a unique string which will change according to the parameter that we have send for checksum generation Api
Gurus, I have created a ARN Topic and Subscribed to SMS and could send SMS message to a phone number using AWS SNS Console. However, when I try same using Swift, I do not receive SMS. Am I missing something? Here's my code to send SMS message using Swift:
let smsSend = AWSSNSPublishInput.init()
smsSend?.phoneNumber = "+1408xyzabcd"// phone_number
smsSend?.subject = "Test SMS Notification"
smsSend?.message = message
smsSend?.topicArn = "arn:aws:sns:us-east-1:12345:XYZ"
var attribute_values = [String: AWSSNSMessageAttributeValue]()
let smsType = AWSSNSMessageAttributeValue.init()
smsType?.stringValue = "Promotional"
smsType?.dataType = "String"
let smsSenderID = AWSSNSMessageAttributeValue.init()
smsSenderID?.stringValue = "xyz"
smsSenderID?.dataType = "String"
attribute_values.updateValue(smsType!, forKey: "AWS.SNS.SMS.SMSType")
attribute_values.updateValue(smsSenderID!, forKey: "AWS.SNS.SMS.SenderID")
smsSend?.messageAttributes = attribute_values
AWSSNS.default().publish(smsSend!)
Not sure what am I missing?
So, I'm using Facebook share sdk on iOS and just want to share example stuff via test user. I'm logged in with permissions:
loginButton.publishPermissions = ["publish_actions"]
loginButton.readPermissions = ["public_profile", "email", "user_friends", "user_likes"]
And I'm making share like this:
let action = FBSDKShareOpenGraphAction()
action.actionType = "og.likes"
action.setString("http://samples.ogp.me/226075010839791", forKey: "object")
let content = FBSDKShareOpenGraphContent()
content.action = action
content.previewPropertyName = "object"
let shareAPI = FBSDKShareAPI()
shareAPI.delegate = self
shareAPI.shareContent = content
let shared = shareAPI.share()
print("shared: \(shared)")
I'm getting following result:
shared: true
didCompleteWithResults [postId: 122321171486204,
completionGesture: post]
Looks like it's working, right? But then I log in that account and cannot see a thing. It's stated: "No posts to see". Also this account has friends and they cannot see anything too.
Why is that so?
I'm using RTCDataChannel. But messages which i'm sending through the channel are not receiving at the other peer.
Here is the code:
let audioConstraint : RTCPair = RTCPair(key: "OfferToReceiveAudio", value: "true")
let videoConstraint : RTCPair = RTCPair(key: "OfferToReceiveVideo", value: "true")
let dtlsConstraint : RTCPair = RTCPair(key: "DtlsSrtpKeyAgreement", value: "true")
let mediaContraints : RTCMediaConstraints = RTCMediaConstraints(mandatoryConstraints: [audioConstraint, videoConstraint], optionalConstraints: [ dtlsConstraint])
RTCPeerConnectionFactory.initializeSSL()
peerConnection = peerConnectionFactory.peerConnectionWithICEServers(servers, constraints: mediaContraints, delegate: self)
dataChannels = peerConnection?.createDataChannelWithLabel(channelName,config: nil)
dataChannels?.delegate = self
var message : NSData = NSData(base64EncodedString: "helloo")
var buffer : RTCDataBuffer = RTCDataBuffer(data: message, isBinary: true)
dataChannels?.sendData(buffer)
Have you resolved it?
One of the two peers should create data channel and other should attach the received data channel object to its data channel object.
The initiator should create datachannel before sending offer. Hope this might be helpful
I had the same problem until I set the option not to nil. If I skipped the steamId, it would not send. Even though the channel is open.
RTCDataChannelInit *dataInit = [[RTCDataChannelInit alloc] init];
dataInit.isNegotiated = YES;
dataInit.isOrdered = YES;
dataInit.maxRetransmits = 30;
dataInit.maxRetransmitTimeMs = 30000;
dataInit.streamId = 12; //important setting
self.dataChannel = [_peerConnection createDataChannelWithLabel:kRTCDataChannelLabel config:dataInit];
self.dataChannel.delegate = self;