I'm adding my interested Place to Google Place with my APP. Place is getting added successfully, but the address field is empty.
Here is Code:
{
GMSPlacesClient.provideAPIKey(googlePlaceAPIKEY)
let placesClient = GMSPlacesClient.shared()
let userAddedPlace = GMSUserAddedPlace()
userAddedPlace.name = "NightClub & Bar"
userAddedPlace.address = "48 Gandhi Road, Bandra, Mumbai, Maharastra"
userAddedPlace.coordinate = CLLocationCoordinate2DMake(19.017615 , 72.856164)
userAddedPlace.phoneNumber = "9999999999"
userAddedPlace.website = "http://www.google.com/"
userAddedPlace.types = ["bar"]
placesClient.add(userAddedPlace, callback: { (place, error) -> Void in
if let error = error {
print("Add Place error: \(error)")
return
}
if let place = place {
print("Added place with placeID \(place.placeID)")
}
})
}
I can see "NightClub & Bar" in my place list but the address "48 Gandhi Road, Bandra, Mumbai, Maharastra" is not there.
Can anyone tell me what mistake I made?
Related
I am developing app with video calling functionality and I am using Twilio Video for that.
Currently using TwilioVideo SDK v4.6.2 and iOS Version 14.x and Above
I am not able to connect to the TwilioVideo room
Below is my code:
func connect() {
guard let accessToken = self.accessToken, let roomName = self.roomName else {
return
}
prepareAudio()
prepareCamera()
let connectOptions = ConnectOptions(token: accessToken) { (builder) in
builder.isDominantSpeakerEnabled = true
builder.isNetworkQualityEnabled = true
if let localAudioTrack = self.localAudioTrack {
builder.audioTracks = [localAudioTrack]
}
if let localVideoTrack = self.localVideoTrack {
builder.videoTracks = [localVideoTrack]
}
if let preferredAudioCodec = TwiloVideoSettingsManager.shared.audioCodec {
builder.preferredAudioCodecs = [preferredAudioCodec]
}
if let preferredVideoCodec = TwiloVideoSettingsManager.shared.videoCodec {
builder.preferredVideoCodecs = [preferredVideoCodec]
}
if let encodingParameters = TwiloVideoSettingsManager.shared.getEncodingParameters() {
builder.encodingParameters = encodingParameters
}
builder.region = "gll"
builder.roomName = roomName
}
self.room = TwilioVideoSDK.connect(options: connectOptions, delegate: self)
UIApplication.shared.isIdleTimerDisabled = true
}
Response in not received from Twilio in either of the methods mentioned below
func didConnect(to room: Room) {
NSLog("Room: \(room.name) SID: \(room.sid)")
if (room.remoteParticipants.count > 0) {
self.remoteParticipant = room.remoteParticipants[0]
self.remoteParticipant.delegate = self
}
self.delegate.videoServiceManagerDidConnectToRoom(name:room.name)
}
func roomDidFailToConnect(room: Room, error: Error) {
NSLog("Failed to connect to a Room: \(error).")
self.delegate.videoServiceManagerFailToConnectRoom(error: error.localizedDescription)
self.leaveRoom()
}
I am not able connect to the room every time and sometimes I get the error mentioned below :
Failed to connect to a Room: Error Domain=com.twilio.video Code=53000 "Signaling connection error" UserInfo={NSLocalizedDescription=Signaling connection error, NSLocalizedFailureReason=SIP error 408}.
When I check the Twilio logs in debug mode I am not getting any error.
Please guide me to rectify if there is any mistake in my code
Twilio employee here. Error 53000 is somewhat vague and could occur due to different things: https://www.twilio.com/docs/api/errors/53000
I'd suggest the following next steps:
try reproducing this error using the iOS Quickstart app (https://github.com/twilio/video-quickstart-ios)
try running our Networktest on the problematic device: https://www.networktest.twilio.com
My code:
let req = MKDirectionsRequest()
req.source = MKMapItem.mapItemForCurrentLocation()
req.destination = destination
let dir = MKDirections(request:req)
if dir.calculating {
print("calculating")
} else {
print("Not Calculating")
}
dir.calculateDirectionsWithCompletionHandler() {
(response:MKDirectionsResponse?, error:NSError?) in
When I print error it shows following:
Error Domain=MKErrorDomain Code=1 "Directions Not Available" UserInfo={NSLocalizedFailureReason=Route information is not available at this moment., NSLocalizedDescription=Directions Not Available, MKDirectionsErrorCode=2, MKErrorGEOError=-902}
It always throws the error above.
I cannot get what those error keys are:
MKErrorGEOError = -902
MKDirectionsErrorCode=2
Googled for more info in it couldn't find it.
It seems that there is a dictionary value I can place in the GET call that corresponds to a property on PDKPin that I can call in my success block to unpack the value, i.e. "url" = PDKPin.url "note" = PDKPin.decriptionText, however I can't find a corresponding property for "link" which is available per the documentation https://developers.pinterest.com/docs/api/pins/?
PDKClient.sharedInstance().getAuthenticatedUserPinsWithFields(Set(["url", "note", "link"]), success:
{ (responseObject :PDKResponseObject!) -> Void in
print("success /(pdk)")
let currentResponseObject = responseObject
let pins = currentResponseObject.pins
self.pinArray = pins()
for pin in self.pinArray {
if let pinAsPDKPin = pin as? PDKPin {
print(pinAsPDKPin.descriptionText)
if let safeURL = pinAsPDKPin.url {
print(safeURL)
}
let link = pinAsPDKPin.link //no such property on PDKPin
}
}
}) { (err :NSError!) -> Void in
print("error NSError: \(err)")
}
It looks kinda weird, but as per the implementation, the 'link' property(from the API) is used as 'url'(in the SDK). Check out the code here : https://github.com/pinterest/ios-pdk/blob/master/Pod/Classes/PDKPin.m#L38
So, if all that you care about is the 'link' from the API, then just access 'url' in the SDK(in PDKPin object).
Mailcore 2 integration:
I am working on "Reply", "Reply All" , "Forward" and Move To features. When I started up with "Reply", I could able to get the Reply mail body full message from MCOMessageView class -> content = [(MCOIMAPMessage *) _message htmlRenderingWithFolder:_folder delegate:self]; and displayed in reply compose view.
Now, I need pre-populate "Reply" (Recipient To) email in the compose view. When I tried "_message.header.replyTo", it is giving me like "mailcore::Address:0x17df0c70 getsy sandriya getsypri8796#gmail.com"
But I need to retrieve the mail address(es) alone from this "_message.header.replyTo", it is giving me like "mailcore::Address:0x17df0c70 getsy sandriya getsypri8796#gmail.com"
How to retrieve Reply email address from "mailcore:.........", please advise.
The definitive answer for me is like the following, i made a quick Swift v2.3 example and it run like the following :
let imapsession = MCOIMAPSession()
imapsession.hostname = "YOUR SERVER"
imapsession.port = 993
imapsession.username = "EMAIL"
imapsession.password = "PASS"
imapsession.connectionType = MCOConnectionType.TLS
let requestKind : MCOIMAPMessagesRequestKind = MCOIMAPMessagesRequestKind.Headers
let folder : String = "INBOX"
let uids : MCOIndexSet = MCOIndexSet(range: MCORangeMake(1, UINT64_MAX))
let fetchOperation : MCOIMAPFetchMessagesOperation = imapsession.fetchMessagesOperationWithFolder(folder, requestKind: requestKind, uids: uids)
fetchOperation.start { (err, msg, vanished) -> Void in
print("error from server \(err)")
print("fetched \(msg?[0]) messages")
let msgs = msg
if msgs?.count > 0 {
for m in msgs! {
let MSG: MCOIMAPMessage = m as! MCOIMAPMessage
let op = imapsession.fetchMessageByUIDOperationWithFolder(folder, uid: MSG.uid)
op.start { (err, data) -> Void in
let msgParser = MCOMessageParser(data: data)
let html: String = msgParser.plainTextBodyRendering()
print("*********************")
print("Mail body\(html)")
print("mail sender:\(MSG.header.sender)")
print("mail recipient:\(MSG.header.to)")
print("mail subject:\(MSG.header.subject)")
print("*********************")
}
}
}
}
In the example above i went a bit far and i gather the mail content as text. you can do it in HTML also.
Hope this answer will help you and help other people who fall in the same issue !
I am using the CoreSpotLight api to index some content. For some reason I am not able to find the data when I search in the
SpotLight.
let atset:CSSearchableItemAttributeSet = CSSearchableItemAttributeSet()
atset.title = "Simple title"
atset.contentDescription = "Simple twitter search"
let item = CSSearchableItem(uniqueIdentifier: "id1", domainIdentifier: "com.shrikar.twitter.search", attributeSet: atset)
CSSearchableIndex.defaultSearchableIndex().indexSearchableItems([item]) { (error) -> Void in
print("Indexed")
}
When I run the app I see that the data is indexed and the error is nil.
Also I have added the CoreSpotLight and MobileCoreServices to the build phase.
Try use itemContentType initializer like so :
let atset:CSSearchableItemAttributeSet = CSSearchableItemAttributeSet(itemContentType: kUTTypeImage as String)
atset.title = "Simple title"
atset.contentDescription = "Simple twitter search"
let item = CSSearchableItem(uniqueIdentifier: "id1", domainIdentifier: "com.shrikar.twitter.search", attributeSet: atset)
CSSearchableIndex.defaultSearchableIndex().indexSearchableItems([item]) { (error) -> Void in
print("Indexed")
}
The kUTTypeImage is declared in MobileCoreServices.