iOS is the operating system for iPhone.

Posts under iOS tag

200 Posts
Sort by:

Post

Replies

Boosts

Views

Activity

Code 3300 error while trying to save a photo to iOS album
While trying to save a photo to a custom album on some devices we get the following error: The operation couldn’t be completed. (PHPhotosErrorDomain error 3300). code: 3300 This is the part of the code where the issue happens PHPhotoLibrary.shared().performChanges({ let assetChangeRequest = PHAssetChangeRequest.creationRequestForAsset(from: image) guard let placeholder = assetChangeRequest.placeholderForCreatedAsset else { return } let albumChangeRequest = PHAssetCollectionChangeRequest(for: album) albumChangeRequest?.addAssets([placeholder] as NSArray) }, completionHandler: { success, error in completion(success, error) }) I would be thankful for any tips since I am out of ideas.
2
3
4.3k
Oct ’23
UIButton image disappears when “debug executable” is unchecked in edit scheme
I have created a UIButton in storyboard, and have set an image for the UIButton (the image is in assets.xcassets). The button shows up in the simulator and when run on an iPhone. However, if I quit the app on the iPhone and open it again, the button disappears, but I am still able to click it and it works. The same thing happens when I uncheck "debug executable." When I check the view hierarchy, the button is on top of the hierarchy but is invisible. Using infoButton.isHidden = false also does not work. In my button's view controller, I have called view.bringSubviewToFront(_: infoButton) in viewDidLoad(). I have also tried setting the button's image programmatically, but it still doesn't show up. However, when I set a background color for the button with infoButton.backgroundColor = UIColor.blue, I can see a blue box where the button should be, but no image. Here are my settings for the UIButton: I would appreciate any help, thank you.
2
1
1.5k
Oct ’23
Puzzling crash on iOS 16.0
Date/Time: 2022-06-10 06:57:07.9651 +0800 Launch Time: 2022-06-09 17:42:25.7993 +0800 OS Version: iPhone OS 16.0 (20A5283p) Release Type: Beta Baseband Version: 2.04.00 Report Version: 104 Exception Type: EXC_BAD_ACCESS (SIGSEGV) Exception Subtype: KERN_INVALID_ADDRESS at 0x0000000000000058 Exception Codes: 0x0000000000000001, 0x0000000000000058 VM Region Info: 0x58 is not in any region. Bytes before following region: 206997290920 REGION TYPE START - END [ VSIZE] PRT/MAX SHRMOD REGION DETAIL UNUSED SPACE AT START ---> commpage (reserved) 3032000000-7000000000 [255.2G] ---/--- SM=NUL ...(unallocated) Termination Reason: SIGNAL 11 Segmentation fault: 11 Terminating Process: exc handler [7705] Triggered by Thread: 53 Thread 53 name: Thread 53 Crashed: 0 libdispatch.dylib 0x0000000186f68554 dispatch_source_set_timer + 32 (source.c:1389) 1 PrivacyAccounting 0x000000020f05632c -[PACoalescingIntervalTracker coalesce:] + 420 (PACoalescingIntervalTracker.m:101) 2 PrivacyAccounting 0x000000020f04af30 __22-[PAAccessLogger log:]_block_invoke + 360 (PAAccessLogger.m:209) 3 libdispatch.dylib 0x0000000186f621cc _dispatch_block_async_invoke2 + 148 (queue.c:555) 4 libdispatch.dylib 0x0000000186f530f4 _dispatch_client_callout + 20 (object.m:560) 5 libdispatch.dylib 0x0000000186f5a7ac _dispatch_lane_serial_drain + 672 (inline_internal.h:2631) 6 libdispatch.dylib 0x0000000186f5b32c _dispatch_lane_invoke + 436 (queue.c:3939) 7 libdispatch.dylib 0x0000000186f65ebc _dispatch_workloop_worker_thread + 652 (queue.c:6766) 8 libsystem_pthread.dylib 0x00000001fe9190a8 _pthread_wqthread + 288 (pthread.c:2599) 9 libsystem_pthread.dylib 0x00000001fe918e48 start_wqthread + 8
9
0
2.2k
Oct ’23
Problem Running multiple Async tasks in View
Hey there, I have a problem running multiply tasks in parallel in a SwiftUI view. struct ModelsView: View { @StateObject var tasks = TasksViewModel() var body: some View { NavigationView{ ScrollView { ForEach(Array(zip(tasks.tasks.indices, tasks.tasks)), id: \.0) { task in NavigationLink(destination: ModelView()) { ModelPreviewView(model_name: "3dobject.usdz") .onAppear { if task.0 == tasks.tasks.count - 2 { Task { print(tasks.tasks.count) await tasks.fetch_tasks(count: 4) } } } } } }.navigationTitle("3D modelle") }.onAppear{ Task { await tasks.fetch_tasks(count: 5) await tasks.watch_for_new_tasks() } } } } In my view, I spawn a task as soon as the View Appears which, first, fetches 5 tasks from the database (this works fine), and then it starts watching for new tasks. In the Scroll View, right before the bottom is reached, I start loading new tasks. The problem is, the asynchronous function fetch_tasks(count: 4) only gets continued if the asynchronous function watch_for_new_tasks() stops blocking. actor TasksViewModel: ObservableObject { @MainActor @Published private(set) var tasks : [Tasks.Task] = [] private var last_fetched_id : String? = nil func fetch_tasks(count: UInt32) async { do { let tasks_data = try await RedisClient.shared.xrevrange(streamName: "tasks", end: last_fetched_id ?? "+" , start: "-", count: count) last_fetched_id = tasks_data.last?.id let fetched_tasks = tasks_data.compactMap { Tasks.Task(from: $0.data) } await MainActor.run { withAnimation(.easeInOut) { self.tasks.append(contentsOf: fetched_tasks) } } } catch { print("Error fetching taskss \(error)") } } func watch_for_new_tasks() async { while !Task.isCancelled { do { let tasks_data = try await RedisClient.shared.xread(streams: "tasks", ids: "$") let new_tasks = tasks_data.compactMap { Tasks.Task(from: $0.data) } await MainActor.run { for new_task in new_tasks.reversed() { withAnimation { self.tasks.insert(new_task, at: 0) } } } } catch { print(error) } } } ... } The asynchronous function watch_for_new_tasks() uses RedisClient.shared.xread(streams: "tasks", ids: "$") which blocks until at least one tasks is added to the Redis Stream. I tried running the watch_for_new_tasks() on a Task.detached tasks, but that also blocks. To be honest, I have no idea why this blocks, and I could use your guy's help if you could. Thank you in Advance, Michael
1
0
1.3k
Oct ’23
WhatsApp Business not launching in iOS16 beta 2
Hi Forum, whatsapp Business was working fine on ios16 beta 2 till 28 June 2022. On 29th the app will not launch at all and kept crashing. To test this, we logged out of WhatsApp business on another developer phone and Re logged in. It stopped Launching on that phone also. we have deleted the app, reset the phone but the problem persists. On reinstalling, moment we restore the messages, it crashes at the next step. any guidance ? Regards Ajay
2
1
1.1k
Aug ’23
how to play back a slow motion video via URL in iOS?
I am trying to support video playback for remote video files in iOS. It works for a regular video, but has a problem with slow motion videos: the slow motion effect is lost. I.e. A slow motion plays back like a regular speed rate video. Here is what I am doing:         AVURLAsset *asset = [AVURLAsset URLAssetWithURL:url options:nil];         [asset.resourceLoader setDelegate:self.urlDelegate                                     queue:[self.urlDelegate getDispatchQueue]];         AVPlayerItem *playerItem = [AVPlayerItem playerItemWithAsset:asset];         AVPlayer *player = [AVPlayer playerWithPlayerItem:playerItem];         AVPlayerViewController *controller = [[AVPlayerViewController alloc] init];         controller.player = player;         [player play];         [self presentViewController:controller animated:false completion:^{ <snipped>         }]; Note, the url points to a QuickTime (.MOV) video file on a HTTP(s) server. Again, the above code plays a slow motion video just like a regular video without any slow motions. Is it because AVURLAsset does not support slow motion video? What are I missing to let AVPlayer plays slow motion? I am targeting iOS 12 and above. Thanks!
1
0
1.5k
Aug ’23
iOS 16 unexpected rotation behaviour
Is anyone facing any issue with rotation on iOS 16? It seems to introduce some unexpected behaviour. For example, if we're on a Master screen that supports all orientations and device is in Landscape mode, presenting/pushing another Details screen that only supports Portrait automatically brings the app to Portrait with no animations. While on iOS 15 or earlier, the app remains at Landscape and only rotates to Portrait when physical device's orientation changes. Then if we dismiss/pop back to Master screen, the app again unexpectedly rotates from Portrait to Landscape with no animations. Looks like a regression bug on iOS 16 part of some recent deprecations related to shouldAutorotate or UIDevice.setValue:forKey: as well as the introduction of setNeedsUpdateOfSupportedInterfaceOrientations.
9
10
15k
Oct ’23
Unable to load contents of file list: '/Target Support Files/Pods-Runner/Pods-Runner-frameworks-Release-input-files.xcfilelist'
Here is my ci_post_clone.sh #!/bin/sh # fail if any command fails set -e # debug log set -x # Install CocoaPods using Homebrew. HOMEBREW_NO_AUTO_UPDATE=1 # disable homebrew's automatic updates. brew install cocoapods # Install Flutter using git. git clone https://github.com/flutter/flutter.git -b stable $HOME/flutter export PATH="$PATH:$HOME/flutter/bin" # Install Flutter artifacts for iOS (--ios), or macOS (--macos) platforms. flutter precache --ios # Install Flutter dependencies. flutter channel master flutter doctor flutter pub get # Generate IOS file flutter build ios --release --no-codesign # Install CocoaPods dependencies. #cd ios && pod install # run `pod install` in the `ios` directory. exit 0
4
0
18k
Jan ’24
How to handle IPv6 link-local addresses in iOS 16?
Our (legacy) code to communicate with peripherals on local IPv6 networks (LAN) adds the zone identifier / interface name ("%en0") to link-local IP addresses (FE80::/10) discovered via SSDP. SSDP is implemented using CocoaAsyncSocket - yes, that part of our code is old... (from before the introduction of the iOS 12+ Network framework). We use these modified IP addresses as the host component of a URL in a URLSession.dataTask. To insert the zone identifier we are using URLComponents (we modify the host and then request the string). This worked fine in iOS 15 and below, but no longer works in iOS 16 (Beta 1/2/3); the host is empty after inserting %en0 in the most recent beta. We have reported this via FB10549269, but from the answer it is unclear to me whether Apple is planning to fix this ("Resolution: Potential fix identified"), or we are doing it wrong. How should we handle IPv6 link-local addresses in iOS 16? (when using URLSession instead of Network) PS: We recently dropped support for iOS 12, but we still need to support iOS 13 and up
3
0
1.9k
Aug ’23
Getting "Caught Error Domain NSURLErrorDomain Code=-1200 \"An SSL error has occurred and a secure connection to the server cannot be made."?
We've enabled ATS restrictions in our app, and everything works fine, except sometimes, randomly, the CDN download resource fails. In most cases, it happens to users who on iOS 14.* and WiFI (VPN helps solve the problem :thinking_face:) Logs: (ExampleClientErrorLogServlet) :: Client error: {"arguments":["test_resource","Caught Error Domain%3DNSURLErrorDomain Code%3D-1200 \"An SSL error has occurred and a secure connection to the server cannot be made.\" UserInfo%3D{NSErrorFailingURLStringKey%3Dhttps://my-url/reource.bin, NSLocalizedRecoverySuggestion%3DWould you like to connect to the server anyway?, _kCFStreamErrorDomainKey%3D3, _NSURLErrorFailingURLSessionTaskErrorKey%3DLocalDownloadTask &lt;A50DCF0E-38F3-4454-A78A-B4552336561E&gt;.&lt;1&gt;, _NSURLErrorRelatedURLSessionTaskErrorKey%3D(\n \"LocalDownloadTask &lt;A50DCF0E-38F3-4454-A78A-B4552336561E&gt;.&lt;1&gt;\"\n), NSLocalizedDescription%3DAn SSL error has occurred and a secure connection to the server cannot be made., NSErrorFailingURLKey%3Dhttps://my-url/reource.bin, NSUnderlyingError%3D0x2882e1050 {Error Domain%3DkCFErrorDomainCFNetwork Code%3D-1200 \"(null)\" UserInfo%3D{_kCFStreamPropertySSLClientCertificateState%3D0, _kCFNetworkCFStreamSSLErrorOriginalValue%3D-9816, _kCFStreamErrorDomainKey%3D3, _kCFStreamErrorCodeKey%3D-9816, _NSURLErrorNWPathKey%3Dsatisfied (Path is satisfied), viable, interface: en0, ipv4, dns}}, _kCFStreamErrorCodeKey%3D-9816}"],"format":"Downloading {} file failed: {}","platform":"ios","version":"2.87.1"} 26.07.2022 01:39:55 [DEBUG][9] :: platform: ios, version: 2.87.1. Downloading test_resource file failed: Caught Error Domain%3DNSURLErrorDomain Code%3D-1200 "An SSL error has occurred and a secure connection to the server cannot be made." UserInfo%3D{NSErrorFailingURLStringKey%3Dhttps://my-url/reource.bin, NSLocalizedRecoverySuggestion%3DWould you like to connect to the server anyway?, _kCFStreamErrorDomainKey%3D3, _NSURLErrorFailingURLSessionTaskErrorKey%3DLocalDownloadTask &lt;A50DCF0E-38F3-4454-A78A-B4552336561E&gt;.&lt;1&gt;, _NSURLErrorRelatedURLSessionTaskErrorKey%3D( ), NSLocalizedDescription%3DAn SSL error has occurred and a secure connection to the server cannot be made., NSErrorFailingURLKey%3Dhttps://my-url/reource.bin, NSUnderlyingError%3D0x2882e1050 {Error Domain%3DkCFErrorDomainCFNetwork Code%3D-1200 "(null)" UserInfo%3D{_kCFStreamPropertySSLClientCertificateState%3D0, _kCFNetworkCFStreamSSLErrorOriginalValue%3D-9816, _kCFStreamErrorDomainKey%3D3, _kCFStreamErrorCodeKey%3D-9816, _NSURLErrorNWPathKey%3Dsatisfied (Path is satisfied), viable, interface: en0, ipv4, dns}}, _kCFStreamErrorCodeKey%3D-9816} _kCFNetworkCFStreamSSLErrorOriginalValue=-9816 _kCFStreamErrorDomainKey=3 _kCFStreamErrorCodeKey=-9816 We've tried nscurl --ats-diagnostics on the URL: Configuring ATS Info.plist keys and displaying the result of HTTPS loads to https:/url-path. A test will "PASS" if URLSession:task:didCompleteWithError: returns a nil error. ============================================================== Default ATS Secure Connection --- ATS Default Connection ATS Dictionary: {} Result : PASS --- ============================================================== Allowing Arbitrary Loads --- Allow All Loads ATS Dictionary: {     NSAllowsArbitraryLoads = true; } Result : PASS --- ================================================================================ Configuring TLS exceptions for url --- TLSv1.3 ATS Dictionary: {     NSExceptionDomains =     {         "url" =         {             NSExceptionMinimumTLSVersion = "TLSv1.3";         };     }; } Result : FAIL Error : Error Domain=NSURLErrorDomain Code=-1200 "An SSL error has occurred and a secure connection to the server cannot be made." UserInfo={NSErrorFailingURLStringKey=url, NSLocalizedRecoverySuggestion=Would you like to connect to the server anyway?, _kCFStreamErrorDomainKey=3, _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask &lt;250D7C7A-A090-41F1-8FED-E73FCB511F41&gt;.&lt;1&gt;, _NSURLErrorRelatedURLSessionTaskErrorKey=(     "LocalDataTask &lt;250D7C7A-A090-41F1-8FED-E73FCB511F41&gt;.&lt;1&gt;" ), NSLocalizedDescription=An SSL error has occurred and a secure connection to the server cannot be made., NSErrorFailingURLKey=url, NSUnderlyingError=0x6000021318f0 {Error Domain=kCFErrorDomainCFNetwork Code=-1200 "(null)" UserInfo={_kCFStreamPropertySSLClientCertificateState=0, _kCFNetworkCFStreamSSLErrorOriginalValue=-9836, _kCFStreamErrorDomainKey=3, _kCFStreamErrorCodeKey=-9836, _NSURLErrorNWPathKey=satisfied (Path is satisfied), viable, interface: lo0}}, _kCFStreamErrorCodeKey=-9836} --- ====================================== nsurl --ats-diagnostic show me another error code -9836 and like I know TLSv1.3 not necessary yet Maybe someone can give some suggestions, any help !! :pray: Thx!
2
2
2.5k
Sep ’23
Certain pods are not working in MacBook M1 chip and prompting error
Dear Apple Developers, I'd like to bring it to your kind notice that, when I try to incorporate certain pods namely - pod 'CountryPickerView' pod 'CryptoSwift' pod 'ACPGriffon' pod 'ACPAnalytics' pod 'ACPMobileServices' pod 'Charts' pod 'GooglePlaces' its evoking an error. Error message -  directory not found for option '-F/Users/a1606085/Library/Developer/Xcode/DerivedData/Test123-dogpfwtyviqwuiajsfvyexviimuf/Build/Products/Debug-iphonesimulator/CountryPickerView' ld: framework not found CountryPickerView. Whereas the below pods are working absolutely fine: pod 'Alamofire' pod 'JSONUtilities' pod 'JJFloatingActionButton' pod 'CropViewController' pod 'ACPUserProfile', '> 2.0' pod 'ACPCore', '> 2.0' pod 'ReachabilitySwift' pod 'SwiftyGif' Here are few things I tried but all of them failed to help: Updated CocoaPods using following command in terminal 'sudo gem install cocoapods' . Then did pod install again Adding arm64 in excluded architecture Uninstalling Xcode application and reinstalled version of Xcode 13.4.1 Clearing data from derived data folder and re building I'm currently using a MacBook Pro M1 chip. Is this an issue with Mac M1 ? Because these pods are working fine in other MacBooks other than M1. Are there any suggestions that can help resolve this problem and make the code work? (Tried attaching screenshots but unable to) Kindly help with this issue ASAP since I've got a project deliverable in pipeline. Thanks in advance
1
0
924
Sep ’23
NavigationSplitView two and three column interfaces in the same app
I am currently learning to create multiplatform applications using SwiftUI and NavigationSplitView, and I faced the problem of arranging different Views in the same App. Let's open the default Notes application, and here, we can see a switch between two and three-column views of the content. So my question is, how to arrange this kind of view for different App pages using NavigationSplitView? First page has two columns interface Second has three columns
3
0
2.8k
Aug ’23
Email validation using RegEx and TextField text color
Hello, I wrote a simple email validation test: struct ContentView: View {     @State private var email: String     @State var emailIsValid: Bool = true          public init(email: String = "")     {         self.email = email     }          var body: some View {         Text("Hello, world!")             .padding()                  TextField("Email", text: $email)             .onChange(of: email) { newValue in                 if(newValue.range(of:"^\\w+([-+.']\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*$", options: .regularExpression) != nil) {                     self.emailIsValid = true                     print("valid")                 } else {                     self.emailIsValid = false                     print("invalid")                 }             }             .foregroundColor(emailIsValid ? Color.green : Color.red)     } } And it works for the email like Test@gmail.com. Text is green. But if I type something like Testerka@gmail.com text stays red. But the print output says 'valid'.
3
0
2.9k
Aug ’23
ScrollViewProxy scrollTo will crash when scrolling outside of bounds of previous (not current) List data source/array in iPad and iOS 16 beta
Hi, It seems that there's a bug in the iOS and iPadOS 16 betas (i've not test in macOS 13 yet), that when after updating a List data source with a bigger array, scrolling to a row of an offset bigger than the previous data array, with ScrollViewProxy, will crash the app with an EXC_BREAKPOINT (code=1, subcode=0x1099d6004) error. Below I attached a sample code to reproduce the crash. In it when opening there's an empty list. When pressing the "Randomize & Select Last" button at the top, the list will be filled with 5 random UUIDs, followed by scrolling to the last row. The app will crash on the second try, when it will try to scroll to an offset bigger than the previous data array (the last row). As a control there's an "Randomize & Select Random" button that will behave more or less like the "Randomize & Select Last" button but will choose a random row to select and scroll. It will only crash if this select row if of an offset bigger that the size of the previous array. This doesn't happen in iOS 15. I've already posted the Radar as FB11302966, however if someone has any toughs on how to solve this problem (or what I'm doing wrong) they are welcome. Sample code: ///A simple data model for the demo. Only stores an UUID. struct DataModel: Identifiable, Hashable { let id: UUID = UUID() var nameUUID: String { id.uuidString } } struct ContentView: View { ///Array with some data to show @State private var data: [DataModel] = [] ///Selected row @State private var selection: DataModel? var body: some View { VStack(alignment: .leading) { HStack { //Create a new array for showing in the list. //This array will be bigger than the last one. //The selection will be the last element of the array (triggering the bug) Button { //Increment the size of the new List by 5 let numberElements = data.count + 5 //Create a new Array of DataModel with more 5 elements that the previous one let newData = (0 ..< numberElements).map { _ in DataModel() } //Select the last element of the array/list. //This will make sure that the scrollTo will go to the end let newSelection = newData.last //Update STate for the new values data = newData selection = newSelection } label: { Text("Randomize & Select Last") } Spacer() //Create a new array for showing in the list. //This array will be bigger than the last one. //The selection will be the a random element of the array (only triggering the bug when the element is ) Button { //Increment the size of the new List by 5 //If empty will start with 40 (reducing the odds of triggering the bug) let numberElements = data.count == 0 ? 40 : data.count + 5 //Create a new Array of DataModel with more 5 elements that the previous one let newData = (0 ..< numberElements).map { _ in DataModel() } //Select a random element of the array/list. //This will scroll if the element is 'inside' the previous list //Otherwise will crash let newSelection = newData.randomElement() //Update State for the new values data = newData selection = newSelection } label: { Text("Randomize & Select Random") } } .padding() //MARK: ScrollViewReader and List ScrollViewReader { proxy in List(data, selection: $selection) { dataElement in //Row (is only the UUID for the rows Text(dataElement.id.uuidString) .id(dataElement) .tag(dataElement) } //action that fires when data changes //it will scroll to the selection .onChange(of: data, perform: { newValue in if let selection { proxy.scrollTo(selection) } }) } } } }
15
17
6k
Sep ’23