I just put my app on the store for pre-order. I wanted to localize it to Spanish (don't ask me why 😅), so it should be supporting English (primary language) and Spanish. However, on the App Store, it thinks that my app only supports Spanish. How do I fix this in App Store Connect (or wherever it should be fixed)? Thank you so much for the help!
Post
Replies
Boosts
Views
Activity
I was searching through all the menus and clicking all sorts of buttons to find my app's total download count. I'm not comprehending why apple couldn't just make a section with the total download count. Could someone please assist me in finding this number? thank you.
I have made an app, and Im only receiving this error recently, so I don't know whats going on:
Thread 1: "*** -[__NSDictionaryM __setObject:forKey:]: object cannot be nil (key: kCLConnectionMessageNameKey)"
In my iOS app, I want to use an audio meter and use this data to perform an action when the audio levels surpass the threshold. I have searched all over the web and can't find any useful info regarding this. Can someone kindly post some sample code? Thanks
My app is supposed to deliver a local notification in the background, but it isnt. The notification works when the app is in the foreground but it just fails to work otherwise. Please help me.
Here is my code:
import UIKit
import CoreLocation
import UserNotifications
class ViewController1: UIViewController, CLLocationManagerDelegate, UNUserNotificationCenterDelegate {
override func viewDidLoad() {
super.viewDidLoad()
UNUserNotificationCenter.current().requestAuthorization(options: [.alert, .sound, .badge]) {
(success, error) in
if error != nil {
print("Authorization failed")
}
}
}
func sendNotification(inSeconds: TimeInterval, completion: @escaping (_ Success: Bool)->()){
let trigger = UNTimeIntervalNotificationTrigger(timeInterval: inSeconds, repeats: false)
let content = UNMutableNotificationContent()
content.title = "Important question:"
content.body = "Have you locked your door?"
content.sound = .defaultCriticalSound(withAudioVolume: 20)
let request = UNNotificationRequest(identifier: "customNotification", content: content, trigger: trigger)
UNUserNotificationCenter.current().add(request) { (error) in
if error != nil{
completion(false)
}else{
completion(true)
}
}
}
var isAtHome = 0
while value < 100 && isAtHome == 0{
deliverNotification()
isAtHome = 1
}
while value > 100 && isAtHome == 1{
isAtHome = 0
}
return value
}
}
}
In my code, a user enters their address, and gets the coordinates of that address in return. These coordinates should get saved to user defaults. Then, these coordinates are accessed by another view, and a mapView with a pin of the user's address is shown.
ViewController 1
@IBOutlet var geocodeButton: UIButton!
@IBAction func geocode(_ sender: UIButton) {
guard let country = countryTextField.text else { return }
guard let street = streetTextField.text else { return }
guard let city = cityTextField.text else { return }
// Create Address String
let address = "\(country), \(city), \(street)"
// Geocode Address String
geocoder.geocodeAddressString(address) { (placemarks, error) in
// Process Response
self.processResponse(withPlacemarks: placemarks, error: error)
}
// Update View
geocodeButton.isHidden = true
activityIndicatorView.startAnimating()
}
private func processResponse(withPlacemarks placemarks: [CLPlacemark]?, error: Error?) {
// Update View
geocodeButton.isHidden = false
activityIndicatorView.stopAnimating()
if let error = error {
print("Unable to Forward Geocode Address (\(error))")
locationLabel.text = "Unable to Find Location for Address"
} else {
var location: CLLocation?
if let placemarks = placemarks, placemarks.count > 0 {
location = placemarks.first?.location
}
if let location = location {
let coordinate = location.coordinate
locationLabel.text = "\(coordinate.latitude), \(coordinate.longitude)"
UserDefaults.setValue(coordinate.latitude, forKey: "lat")
UserDefaults.setValue(coordinate.longitude, forKey: "long")
} else {
locationLabel.text = "No Matching Location Found"
}
}
}
extension String {
var doubleValue: Double {
return Double(self) ?? 0
}
}
View Controller 2:
override func viewDidLoad() {
super.viewDidLoad()
if let latitude = UserDefaults.value(forKey: "lat") as? Double{
coordinate1.latitude = lat
}
if let longitude = UserDefaults.value(forKey: "lat") as? Double{
coordinate1.longitude = long
}
When I try to run this, I get an error:
Thread 1: "[<NSUserDefaults 0x1dad81bd0> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key lat."
Please help me solve this issue soon, thanks!
I am having trouble with accessing the main.storyboard, the app works fine, but there is a weird exclamation point.
In my project, the user should be able to take a photo, and save it to the camera roll. How do I add this functionality to my code. I have already added the save photo button, and maybe I call a function to save it. Someone please assist me in doing this thanks. My code down below:
//
// ViewController.swift
// takePictureWithCamera
//
// Created by Vaibhav Satishkumar on 11/20/21.
//
import UIKit
class ViewController: UIViewController {
@IBAction func savePhoto(_ sender: Any) {
}
@IBOutlet var imageView: UIImageView!
@IBOutlet var button: UIButton!
override func viewDidLoad() {
super.viewDidLoad()
imageView.backgroundColor = .secondarySystemBackground
}
@IBAction func didTapButton(){
let picker = UIImagePickerController()
picker.sourceType = .camera
picker.allowsEditing = true
picker.delegate = self
present(picker, animated: true)
}
}
extension ViewController: UIImagePickerControllerDelegate, UINavigationControllerDelegate{
func imagePickerControllerDidCancel(_ picker: UIImagePickerController) {
picker.dismiss(animated: true, completion: nil)
}
func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [UIImagePickerController.InfoKey : Any]) {
picker.dismiss(animated: true, completion: nil)
guard let image = info[UIImagePickerController.InfoKey.editedImage] as? UIImage else
{
return
}
imageView.image = image
}
}
Hello people,
I have a question on how to get a user's location in the background using the always permission. It seems like apple's policies have changed, and I am unsure of how to do this. There are no good resources online and I am stuck.
I am unaware of how to get location data in the background/while the app is closed. I do know how to use when in use description, and when i try changing everything in my code and plist to "always in use" the app doesn't work with the location data.
When my app is open, and left for a long time, the phone doesn't turn off, it just stays on, consuming battery life. In other apps, the phone just turns off after like 5 minutes
I really need to make a notification to be delivered locally:
if (x<5){
//send notification
}
Please answer soon
How do I display a value in a label in my Xcode app (the value keeps changing/updating)? So in my code, there is a pinned location and a user location, and I made some code to make a variable that tells the distance between the two points that continuously updates. I want to display this variable in a label so I can see how it updates. Here is my code:
let value = userLocation.distance(from: pointLocation)
If my value is higher that 10, a notification should pop up saying, "You are beyond the radius"
let value = userLocation.distance(from: pointLocation)
if (value > 10){
//trigger notification
}
I am not sure of how to do this, please help.
I want to make a notification that gets triggered by an if statement.
if (value > 10){ //trigger notification}
I am not sure of how to do this, please help.