I have a question, I know there a new version of ShareKit 2.0, but I only use facebook and twitter, I adapted the code to my needs and I have corrected some mistakes, I will not change the version because it would change everything that I have already done and it works. But I can not correct this: UnKnown Error.
I had already had and just change by OAMutableURLRequest * oRequest = [[OAMutableURLRequest alloc] initWithURL: [NSURL URLWithString: # "https://api.twitter.com/1/statuses/update.json"] in SHKTwitter.m and was solved.
Could you advise me to do without having to switch to the new version?.
Excuse my English, I'm learning.
Related
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.
We are trying to migrate a hybrid app from UIWebView (iOS < 8) to WKWebView (iOS 8), but we are getting SecurityErrors when trying to store stuff using the DOM WebDatabase API (i.e. 'web sql databases').
The following throws an error if the index.html has been loaded from a bundled file with the app
// throws SecurityError: DOM Exception 18
var db = openDatabase('mydb', '1.0', 'key value store', 1);
The same code works fine with UIWebView. I can fallback to using Local Storage for some reason, but using WebSQL databases is a no go. I can only speculate that this has something to do with the same origin policy or something related.
The funny thing is that loading index.html from the network works fine :-/
Any clues as to how I can work around this? Any options to set on the WKWebView that fixes it?
This is how we load the web related stuff:
NSString *htmlPath = [[NSBundle mainBundle] pathForResource:#"index" ofType:#"html"];
NSURL *baseURL = [NSURL fileURLWithPath:htmlPath];
NSURLRequest *request = [NSURLRequest requestWithURL:baseURL];
WKWebViewConfiguration *config = [[WKWebViewConfiguration alloc] init];
[config.userContentController addScriptMessageHandler:self.myCallbacks name:#"NativeApp"];
self.webView = [[WKWebView alloc] initWithFrame:self.view.frame configuration:config];
[self.webView loadRequest:request];
The html file simply loads a javascript file that has a relative path, "myCode.js".
There is an issue (OpenRadar) with WKWebView in iOS 8.0 (and 8.1 B1, I think) that prevents it from loading local files. It might be affecting local storage too. See this question for more details.
You can fix this by adding the following method to the UIDelegate of your WKWebView.
- (void) _webView:(WKWebView *)webView
decideDatabaseQuotaForSecurityOrigin:(WKSecurityOrigin *)securityOrigin
currentQuota:(unsigned long long)currentQuota
currentOriginUsage:(unsigned long long)currentOriginUsage
currentDatabaseUsage:(unsigned long long)currentUsage
expectedUsage:(unsigned long long)expectedUsage
decisionHandler:(void (^)(unsigned long long newQuota))decisionHandler {
decisionHandler(1024*1024*50); //default to 50MB
}
It gives all databases a quota of 50MB, instead of the default of 0 which allows them to be opened. This behavior isn't documented, so I don't know where Apple stands with this.
Also, it appears this issue will be fixed in iOS 10.
I've made a 'plugin' that allows you to use WebSQL (more an implementation of it) in the WKWebView. It can be found here
https://github.com/ajwhiteway/WKWebSQL
import WKWebSQL
.
.
.
var webView = WKWebView(frame: view.frame, configuration: WKWebViewConfiguration())
WKWebSQL.LoadPlugin(webView)
To get it loaded into the page. Versioning isn't really supported at this time. Feel free to add it.
Developing the Native App for ipad,
Initial screen i have on 'ViewDidLoad' a webcall made to read a file on web getting me the results and showing the list.
Prob 1: when i change the content of file in Web it doesnt reflect in my app, even i kill app still result is old same. can anyone help me with this issue.
After this list select it lands to WebView.
Prob 2: When i change anything on server side javascript. it doesnt reflect on the Native App, it does still give me old response only. (i.e Javascript and Css changes are not reflect in App). Can anyone please help me throught this part.
IOS 7 native App in Ipad. If you need code i can post it.
You should specify a CachePolicy:
enum
{
NSURLRequestUseProtocolCachePolicy = 0,
NSURLRequestReloadIgnoringLocalCacheData = 1,
NSURLRequestReloadIgnoringLocalAndRemoteCacheData = 4, // Unimplemented
NSURLRequestReloadIgnoringCacheData = NSURLRequestReloadIgnoringLocalCacheData,
NSURLRequestReturnCacheDataElseLoad = 2,
NSURLRequestReturnCacheDataDontLoad = 3,
NSURLRequestReloadRevalidatingCacheData = 5, // Unimplemented
};
typedef NSUInteger NSURLRequestCachePolicy;
Try this:
[webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:myURLString] cachePolicy:NSURLRequestReloadIgnoringLocalAndRemoteCacheData timeoutInterval:nil]];
I am currently having trouble with upload in the sample - doesn't work with below error message "Invalid Date Time value received."
It seem to be complaining about how the date is formatted as string - yyyy-MM-ddTHH:mm:ss.SS is how the iPhone sample code originally formatted it to, changed it to yy-mm-ddTHH:mm:ss:SSS as said in HTML5 example inline documentation, and few other formats, but no luck.
What is the correct format?
Here're what I've done to get the sample to work for download part...
As instructed, I have changed the URI in plist file.
Looking at HTML5 example, I realized the URL for webservice was in wrong format, so changed them as below..
//self.uploadURL = [NSURL URLWithString:[NSString stringWithFormat:#"%#/DefaultScopeSyncService.svc/?syncScope=DefaultScope&operation=UploadChanges&userid=%#", self.baseURL, [anc valueForKey:#"userID"]]];
self.uploadURL = [NSURL URLWithString:[NSString stringWithFormat:#"%#/DefaultScopeSyncService.svc/defaultscope/UploadChanges?userid=%#", self.baseURL, [anc valueForKey:#"userID"]]];
//self.downloadURL = [NSURL URLWithString:[NSString stringWithFormat:#"%#/DefaultScopeSyncService.svc/?syncScope=DefaultScope&operation=DownloadChanges&userid=%#", self.baseURL, [anc valueForKey:#"userID"]]];
self.downloadURL = [NSURL URLWithString:[NSString stringWithFormat:#"%#/DefaultScopeSyncService.svc/defaultscope/DownloadChanges?userid=%#", self.baseURL, anc.userID]];
In case this helps someone else...
Found the format that works. yyyy-MM-ddTHH:mm:ss.SSSSSSS
The time format conversion seem to be done in Formatters/FormatterUtilities.cs file
It seems that over the weekend, the following Delegate method
- (void)OAuthTwitterController:(SA_OAuthTwitterController *)controller authenticatedWithUsername:(NSString *)username
began returning nil for the username parameter.
I wanted to see if anyone else using Ben Gottlieb's SDK can confirm this issue.
Thanks
I had the same issue today. The app worked fine for the past 2 months.
One thing I changed was the bundle id. Maybe this has something to do with this error, because everything else is the same. Did you happen to change this too?
I changed to https the urls for twitter on SA_OAuthTwitterEngine.m and it seems to be working fine now.
Here is the code I changed:
self.requestTokenURL = [NSURL URLWithString: #"https://twitter.com/oauth/request_token"];
self.accessTokenURL = [NSURL URLWithString: #"https://twitter.com/oauth/access_token"];
self.authorizeURL = [NSURL URLWithString: #"https://twitter.com/oauth/authorize"];
This still works fine for me. Have you tried the native Twitter API (if that's an option)?