Questions tagged [nsurl]
NSURL is a class from Foundation.framework in Apple MacOS and iOS. The NSURL class provides the ability to manipulate URLs and the resources they refer to. An NSURL object represents a URL that can potentially contain the location of a resource on a remote server, the path of a local file on disk, or even an arbitrary piece of encoded data. It is available in iOS 2.0 and later
nsurl
1,650
questions
0
votes
1
answer
39
views
Unable to create file in specified directory because of security scope resource errors in iOS app
Goal: A user selects a folder in Files app where they would create files in that folder. This is an iOS app. This folder path is saved in the iOS app, using this app user would create file ...
0
votes
2
answers
146
views
Do we have a list of NSURL Error Code Values given by Apple somewhere?
Can someone post the value for the list of possible NSURLError codes.
I am getting -1004 as the error code value, I can see based on the description it is "Could not connect to the server", ...
1
vote
0
answers
29
views
Is it safe to assume that the initializer URLComponents(url:resolvingAgainstBaseURL:) never returns nil? [duplicate]
When you have a URL in Swift and want to create a URLComponents instance from it, you have to use this initializer:
init?(url: URL, resolvingAgainstBaseURL: Bool)
I never understood why this ...
2
votes
1
answer
856
views
iOS 17 NSURL percentage gets double encoded
in iOS 17 NSURL parsing changed to use RFC 3986 from RFC 1738/1808
(https://developer.apple.com/documentation/foundation/nsurl/1572047-urlwithstring). Based on RFC 3986 guidance , the reserved ...
0
votes
1
answer
36
views
Defining the type of a completionHandler in Objective-C
I can't manage to get the responseCompletion type correct, at the for cycle.
Tried to replace it with typedef, but got no luck, only more errors.
@interface ImageManager : NSObject
//typedef void(^...
0
votes
1
answer
58
views
Why does NSURL POST file upload task fail to upload to web server
I am trying to upload a text file to a web server from an iOS application. I have written an objective C method to handle the upload request and a PHP file to handle the POST request at the server. I ...
1
vote
0
answers
44
views
UnwantedCommunicationReportingExtension API calling failing
I want to add UnwantedCommunicationReportingExtension to my iOS app to report calls from Call History. I created UI for that and I can see the report button on Call History and Extention is opening. I ...
1
vote
1
answer
251
views
how to convert NSUrl into local path url in swift
In my share extension that is built with electron app I am having trouble getting the shared path as simple local path url from nsurl as I am very new to Swift .
let url = URL(string: nsurl!.path)
...
3
votes
1
answer
554
views
openURL fails with Settings Scheme
I'm trying to add a button to quickly access the iCloud Keychain. I'm aware that it isn't allowed on the App Store, that is fine.
Based on this article I found the preferred deep link for iOS Settings ...
0
votes
1
answer
65
views
Path part of "filename.m4v" is "/private/tmp", which is unexpected
I'm writing some Swift code to parse filenames of video files and extract the show, season and episode. These are returned as key/value parts in a dictionary. As part of my unit tests, I found ...
0
votes
1
answer
173
views
How to convert ImageSourse to NSUrl or CGImage in xamarin ios
I want to convert the ImageSource or image byte array to Xamarin.ios NSUrl or CGImage. How to implement this. I am generating the byte Array from LayoutView like below. So after getting the the byte ...
0
votes
1
answer
361
views
How to convert string with spaces to NSURL [duplicate]
Run below code in playground
import UIKit
let serverUrl = "smb://example.net/Data/OS/Home/test/untitled folder"
let sharePath = NSURL(string: serverUrl)
sharePath value is returning nil
...
-2
votes
1
answer
300
views
stringByRemovingPercentEncoding resulting in null string
I've got a file path /Users/alexandra/Downloads/folder%20with%20spaces/ and I want to remove the percent encoding and make it a file URL. Using the method stringByRemovingPercentEncoding makes the ...
0
votes
1
answer
36
views
Assuring that HTTP cannot be used with NSImage initWithContentsOfUrl (and other such APIs)
I have code to synchronously load an image from a website:
NSURL* url = [NSURL URLWithString:[NSString stringWithCString:urlString encoding:NSUTF8StringEncoding]];
returnImage = [[NSImage alloc] ...
0
votes
1
answer
115
views
How to remove paramters in NSURL's query in iOS?
I use this string to build NSURL
https://123.com?p1=AA&p2=BB&p3=CC
and I want to remove the p1 & p2 paramter,just left the p3 only:
https://123.com?p3=CC
Is there any nicer way than the ...