Issue with brackets in affiliate-urls - ios

I am using the Zanox affiliate program.
My url has the following structure:
ad.zanox.com/ppc/?foo&zpar0=[[bar]]
While i link from my native iOS-application and it will open the Safari the square double brackets "[[]]" are encoded into "%5B%5B%5D%5D" so that my link from above at Safari now looks like:
ad.zanox.com/ppc/?foo&zpar0=%5B%5Bbar%5D%5D
Objective-C:
_postUrl = #"ad.zanox.com/ppc/?foo&zpar0=[[bar]]";
NSString *button = [self htmlButtonWithTitle:#"Affiliate-Link" andURL:_postUrl];
Is there any possibility to keep the square double brackets?
My only workaround now is to use bit.ly for the affiliate link. So far this only affects Zanox platform for me. It's an extra (unwanted) redirect, but better than nothing. Any other ideas?

Related

eBuildfire: IOS issue for buildfire.navigation.openWindow parameter encoded

Buildfire suppor team, I'm trying to open up a new link using buildfire.navigation.openWindow and I noticed an issue on IOS with the URL parameters, as the = (equal sign) gets URL encoded. Please see my example below and the attached screenshot.
https://example.com/something?id=1654161096657Felix
is transformed to
https://example.com/something?id%3D1654161096657Felix
app code screenshot
Example URL works fine:
buildfire.navigation.openWindow("https://example.com/something?id=1654161096657Felix", "_system")
And when inspecting the new window on device I'm getting this:
I would check the server (the real URL) you are using and see if it is redirecting the url to something else.

iOS - Pinterest Sharing Description Text not working if I send "&" in description text

I had implemented pinterest sharing code in my app as well. Its working fine. But problem arrives at one scenario see follow
Correct working:
[pinterest createPinWithImageURL:[NSURL URLWithString:imageUrl]
sourceURL:[NSURL URLWithString:[NSString stringWithFormat:#"%#",shareUrl]]
description:#"My Description"];
Then it will share Pinterest Description same My Description as per my expectation.
But when I send Description Test like :
[pinterest createPinWithImageURL:[NSURL URLWithString:imageUrl]
sourceURL:[NSURL URLWithString:[NSString stringWithFormat:#"%#",shareUrl]]
description:#"My Details & Description"];
Then it will share Pinterest Description like My Details.
My expected text here is My Details & Description this is trunks my string after & symbol.
What actually wrong happening with me please look at here.
AFAIK, Pinterest's Pin It SDK isn't open source, so it's difficult to find out what's really going on.
I would guess, however, that this method is creating a GET request under-the-hood that's incorrectly URL encoding the description parameter (perhaps they're using stringByAddingPercentEscapesUsingEncoding or some other naive method).
I'd recommend contacting the Pinterest SDK developers/maintainers to look into this.
As a quick fix, you might try URL encoding the & yourself. For example, you might try replacing & with %26, e.g.
NSString *description = // ...whatever it should be set to...
description = [description stringByReplacingOccurrencesOfString:#"&" withString:#"%26"];
However, this might actually lead to other problems as the Pinterest SDK is likely doing some sort of URL encoding and would likely encode the % symbol.
Another naive approach may simply be to replace & with the word and, such as
NSString *description = // ...whatever it should be set to...
description = [description stringByReplacingOccurrencesOfString:#"&" withString:#"and"];
Again, it's hacky, but it's a workaround for a bug that's likely in the underlying SDK.

Prevent UIWebView from showing UIPopoverController for tel links

I'm working on an iPad application with UIWebView(Deployment target iOS 5.0+).
My UIWebView should do nothing when user taps emails, addresses and phone numbers.
I have a problem with phone numbers. If html page contains links like this: 555-555-5555 when user taps this link UIPopoverController appears(Add to Contacts, Copy).
I have tried next:
Switch off detection in xib file for UIWebView
webView.dataDetectorTypes = UIDataDetectorTypeNone;
call JS - document.documentElement.style.webkitTouchCallout = "none";
UIWebView delegate method shouldStartLoadWithRequest doesn't work for telephone numbers on iPad but works fine on iPhone.
Do you have any ideas?
The reason that particular phone number link isn't getting disabled is that it's not a detected phone number, it's just a regular old <a href=foo> link that happens to have a telephone link for its href attribute. Setting the dataDetectorTypes like you're doing is the the right way to disable phone number detection. So if you have phone numbers just appearing in the web page text somewhere and you want to prevent those from becoming links, keep using webView.dataDetectorTypes = UIDataDetectorTypeNone;.
If you want to disable all links that look like phone numbers you will need to execute a JavaScript after the page has finished loading. In your UIWebView's delegate's webViewDidFinishLoad method use [webView stringByEvaluatingJavaScriptFromString:] and pass in JavaScript to replace the offending links. Here's an example JavaScript that would replace all your tel style links with text elements showing the phone number instead. You might want something slightly different, or maybe you just want to remove the links from the DOM entirely.
var links = document.getElementsByTagName('a');
for (var j = 0; j < links.length; j++) {
var href=links[j].getAttribute('href');
var prefix = href.substring(0,4);
if (prefix == "tel:") {
var parentNode = links[j].parentNode;
var replacementNode = document.createTextNode(href.substring(prefix.length, href.length));
parentNode.replaceChild(replacementNode, links[j]);
}
}

iOS Apple Map native links - URL Scheme examples

In one of my projects I'm capturing the Lat/Long coords in a core data store, and later on providing this information in an email with Attached PDF.. On the receiving end, I'd like the convenience of another iPhone user to be able to click on the link, and go to that location in Apple Maps
I find the native apple map comes up, but it's simply an open map view w/no pin:
NSString *appleLink2 = [NSString stringWithFormat:#"http://maps.apple.com/maps
ll=%#,%#",self.lat,self.lon];
I'm creating the clickable in a common fashion with a CGRect, and NSURL
It appears on the surface that I should probably get the street address instead of the Lat/Long coords also, and use the address for better map resolution... Thoughts?
Also, I'm looking for examples of Apples URL Schemes to query strings mentioned in the Docs, but can't find any real examples... ll = , son =, t = , z =. I understand saddr and daddr, and am surprised that I can't find any reference or real examples anywhere.
If you want the pin to be placed on the map in Apple's Maps app, use a 'q' instead of 'll' in the URL:
NSString *appleLink2 = [NSString stringWithFormat: #"http://maps.apple.com/maps?q=%#,%#", self.lat, self.lon];
The following apple link has all details for the questions
http://developer.apple.com/library/ios/#featuredarticles/iPhoneURLScheme_Reference/Articles/MapLinks.html
USE NSString for URL
NSString *appleLink2 = [NSString stringWithFormat:#"http://maps.apple.com/maps
ll=%#,%#",self.lat,self.lon];
NSURL *myUrl = [NSURL URLWithString:[appleLink2 stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
Then use myUrl is as URL.

Finding a url in NSString

How can I search a NSString for a url in Xcode iOS?
For instance, If scan it for
HTTP://
and detect where the end of that url is and return the url string.
NSSearchFieldCell Class Reference
is only available on Mac development.
Check out this link I think it should be work NSDataDetector

Resources