nsurl

How to send NSArray to web service

大憨熊 提交于 2019-12-04 22:03:25
I have no success to send NSArray to web service. Service method is not called. But other service methods call works. Web service method is: [WebMethod] public int Method(IList items){... My array is full of objects Items: @interface Item : NSObject { double prop1; double prop2; double prop3; } @property double prop1; @property double prop2; @property double prop3; From objective c I try to send data like this: NSString *soapMsg = [NSString stringWithFormat: @"<?xml version=\"1.0\" encoding=\"utf-8\"?>" "<soap:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http:/

How to get NSURL on specific file from document directory in swift

你说的曾经没有我的故事 提交于 2019-12-04 20:47:08
I getting files from document directory with the help of NSFileManager . I got an array of file names and I can pass them to another controller. Still I want to pass NSURL on specific file from my UITableViewCell as I pass names of these files. My files are mp3. Please help me. var listOfMP3Files: Array<String!>? // for Cell data func fetchFilesFromFolder() { var fileManager = NSFileManager.defaultManager() var folderPathURL = fileManager.URLsForDirectory(NSSearchPathDirectory.DocumentDirectory, inDomains: NSSearchPathDomainMask.UserDomainMask)[0] as! NSURL var documentsContent = fileManager

Posting picture from iphone to facebook wall

有些话、适合烂在心里 提交于 2019-12-04 18:33:36
I'm using Facebook Connect for iOS to post a picture, taken in an app, to facebook wall, possible using the local file URL, according to another post: adding photo on facebook wall The URL appears to be pointing somewhere valid, but the picture doesn't show up. Verified that it does work with a web link. Anyone have an idea why this isn't working for local files? Would I need permissions beyond regular wall posts? Help! According to facebook, any image posted to a stream has to be web accessible, so what I wanted to do just isn't possible. The only way to get this to work is to upload the

How to open calendar with event - NSURL calshow:

无人久伴 提交于 2019-12-04 18:01:23
问题 I'm wondering if there is someone who knows how to launch calendar with a specific event from APP I've done some research and I've come up with two ways to open native calendar from inside the app using NSURL "calshow://" which opens calendar at current date "calshow:\(someNSDate.timeIntervalSinceReferenceDate)" which opens calendar with date of someNSDate I also found this website that lists calshow:x?eventid=id as url but I'm not sure if this works (listed as not public) and I couldn't get

encoding url using swift code

南笙酒味 提交于 2019-12-04 17:06:29
问题 I need to send an URL in Arabic language, so I need to encode it before I put it in URL. I am using Swift code. Below is an example what i really need var s = "www.example.com/السلام عليكم" let url = NSURL(string : s) So the word (السلام عليكم) is in Arabic characters that what I want to send. 回答1: Swift 2.0 let urlwithPercentEscapes = myurlstring.stringByAddingPercentEncodingWithAllowedCharacters( NSCharacterSet.URLQueryAllowedCharacterSet()) Swift 3 let urlwithPercentEscapes = myurlstring

iOS Swift. How to get a GPS metadata from just a UIImage (NSURL)?

痞子三分冷 提交于 2019-12-04 13:50:14
问题 Have a reference to an image only having its NSURL. How to get a GPS metadata from it? Of course, I can load a UIImage from NSURL, but then what? Majority of answers I've found here is regarding UIImagePicker, and using ALAssets then, but I have no such option. 回答1: Answering my own question. The memory-effective and fast way to get a GPS metadata is let options = [kCGImageSourceShouldCache as String: kCFBooleanFalse] if let data = NSData(contentsOfURL: url), imgSrc =

Get resource URL from project specific path

假装没事ソ 提交于 2019-12-04 10:05:51
问题 I need to retrieve the URL of a resource contained in my Xcode project through a path that begins in the project's directory (aka mainBundle) So if my specified path if ./snd/archer/acknowledge1.wav, I need to create a URL from that. I know I can use NSURL(fileURLWithPath:) for system directories, but I don't know how to do this directly from the bundle. 回答1: You would use one of the bundle resourse URL methods [[NSBundle mainBundle] URLForResource:@"acknowledge1" withExtension:@"wav"

Check string containing URL for “http://”

不打扰是莪最后的温柔 提交于 2019-12-04 08:36:42
I am trying to check the URL entered by the user, but I am fighting against some errors and warnings. -(BOOL) textFieldShouldReturn:(UITextField *)textField { //check "http://" NSString *check = textField.text; NSString *searchString = @"http://"; NSRange resultRange = [check rangeWithString:searchString]; BOOL result = resultRange.location != NSNotFound; if (result) { NSURL *urlAddress = [NSURL URLWithString: textField.text]; } else { NSString *good = [NSString stringWithFormat:@"http://%@", [textField text]]; NSURL *urlAddress = [NSURL URLWithString: good]; } // open url NSURLRequest

URL encoding iOS NSURL error

廉价感情. 提交于 2019-12-04 06:58:19
问题 URL which opens in Firefox,Chrome browsers on desktop, doesn't open in WebView on iPhone. This URL is supposedly accessing a GET request. When creating the NSURL without percentescaping the url doesn't get generated. When using percentescape the url redirects to a Bad url content. Is there a different encoding used on desktop browsers and not on the iPhone? or mobile Safari? Are there different ways to encode the URL in iOS other than using -stringByAddingPercentEscapesUsingEncoding

How do I convert url.query to a dictionary in Swift?

孤街醉人 提交于 2019-12-04 05:35:20
I have a URL coming in to the AppDelegate method: func application(_ application: UIApplication, open url: URL, sourceApplication: String?, annotation: Any) -> Bool { } The URL looks like www.wesite.com/shareplace.html?placeid=123 . How can it be converted to a dictionary for easy access? I found some code on some website, but it's showing an error in Xcode 9: extension URL { var queryDictionary: [String: AnyObject]? { return URLComponents(url: self, resolvingAgainstBaseURL: false)? .queryItems? .reduce([:], combine: { (var result: [String: AnyObject], queryItem) -> [String: AnyObject] in if