I know how to check app version on iPhone and tried the same way for an app installed on Apple watch in Watch App General -> Usage however not able to see app version. Can anybody help me find the app version on apple watch?
I needed to check an app's version for the app's tech support, so they told me to open the App Store on the watch, find the app and see if it says "Update" or "Open". The store shows the current version and if the button said "Open", it is up-to-date. I don't know yet how to check another way, but thought this may help you.
There is no way to check the version on Apple Watch as per my investigation. mostly the apple watch version is the same as the iPhone app version.
Swift way of getting the current app's version and build number. 😁
add this extension to your project. either as a separate file or in one of your existing files.
then you can get the version and build number like this:
let version = Bundle.version // e.g: 1.2
let build = Build.build // e.g: 16
let versionAndBuild = Build.versionAndBuild // e.g: v1.2(16)
please be careful to not use Build.version() instead. it'll return "0".
and here is the extension:
import Foundation
import WatchKit
public extension Bundle {
static var version: String? {
return Bundle.main.object(forInfoDictionaryKey: "CFBundleShortVersionString") as? String
}
static var build: String? {
return Bundle.main.object(forInfoDictionaryKey: kCFBundleVersionKey as String) as? String
}
static var versionAndBuild: String? {
guard let version = Bundle.version,
let build = Bundle.build else {
return nil
}
return version == build ? "v\(version)" : "v\(version)(\(build))"
}
}
Related
I just downloaded the Xcode 14 release candidate and I started getting the following crashing error on startup (didn't try the other betas). I made no changes in the codebase. CloudKit was working fine before:
[CK] BUG IN CLIENT OF CLOUDKIT: Not entitled to listen to push notifications. Please add the 'aps-connection-initiate' entitlement.
Under Certificates, Identifiers & Profiles in the Developer portal, I've verified that push notifications are enabled.
To fix, I tried removing and re-adding the push-notifications entitlement.
I verified that the APS Environment value is in the entitlements .plist.
I switched off automatic signing and then turned it back on again. I cleaned the build and deleted derived data. I also tried switching back to Xcode 13.4.1 and everything started working again - unfortunately, not a solution.
The error occurs right as container.loadPersistentStores is called.
lazy var persistentContainer: NSPersistentCloudKitContainer = {
/*
The persistent container for the application. This implementation
creates and returns a container, having loaded the store for the
application to it. This property is optional since there are legitimate
error conditions that could cause the creation of the store to fail.
*/
let container = NSPersistentCloudKitContainer(name: "not_real_name")
guard let description = container.persistentStoreDescriptions.first else {
fatalError("No descriptions found (AppDelegate.persistentContainer)")
}
description.setOption(true as NSObject, forKey: NSPersistentStoreRemoteChangeNotificationPostOptionKey)
container.loadPersistentStores(completionHandler: {
(storeDescription, error) in
if let error = error as NSError? {
Is this just an Xcode beta bug (in the release candidate)? Is there a way to work around it?
I also just ran into this error today, on the Xcode 14.0 RC. It was on a basically brand new project so I figured it must be something odd with the new version.
To fix, I just did what the error said:
<key>aps-connection-initiate</key>
<true/>
Added that to the app's Info.plist, then it ran again just fine. Also SwiftUI previews started working again.
If you are facing this in simulator. Go to Device -> Erase all content ad settings.. And reinstall the app.
open .entitlements file
and then add "aps-connection-initiate" key and set the value to true
That worked for me
I want to retrieve some meta data of a photo asset in the Photo library. Basically the name, type and location of it. I want to implement it as a command line utility in Swift.
Here is the code I have come up with
var allPhotos : PHFetchResult<PHAsset>? = nil
let fetchOptions = PHFetchOptions()
allPhotos = PHAsset.fetchAssets(with: .image, options: fetchOptions)
But it fails to compile because of 'fetchAssets(with:options:)' is only available in macOS 10.15 or newer.
My app is targeted to run on 10.14 and my MBP is still running 10.14.
When I check the documentation page (https://developer.apple.com/documentation/photokit/phasset),
I can't find the os version information next to each API on the page.
What is the easiest way to find such information?
Also how can I make the code work for 10.14?
macOS Version Requirements
What is the easiest way to find such information?
It says on the page that 10.15+ is required:
Alternatives
Also how can I make the code work for 10.14?
Use fetchAssets(in:options:) (min 10.13) instead of fetchAssets(with:options:) (min 10.15).
I have recently upgraded to Swift 4.2 and I am not able to run my project anymore since then.
I had hundreds of mistakes which I all fixed, the app starts but crashes as soon as it tries to access data from my database
example code
guard let currentUser = API.User.CURRENT_USER?.uid else {return}
crash: Thread 1: signal SIGABRT
I had my app working for over a year now and thousands of users so the code worked previously quit fine.
I have updated my cocoa pods to the newest point, as my terminal said that firebaseauth requires at least 1.4 cocoa pods.
I have updated and newly installed all pods, I deleted my plist and downloaded it again and put it into the project, all to no avail.
My app is working if you download the old version from the App Store, but I want to update some things and need it to run again
Any advice? I have tried everything I found
For Firebase 4/5 and Swift 4, here's the function call to get the currently authenticated users uid
guard let currentUser = Auth.auth().currentUser?.uid else { return }
i want to make a phone call from Apple Watch too. I imported WatchKit. Then i put this code in my method:
if let telURL=NSURL(string:"tel:5553478") {
let wkExtension=WKExtension.sharedExtension()
wkExtension.openSystemURL(telURL)
}
It shows me an error: Use of unresolved identifier 'WKExtension' in line 2. I don't know what I am doing wrong :/
WKExtension is only available on WatchOS 2.0, as you can see from Apple's prerelease reference. So I'm guessing you're either not using Xcode 7 or you're working on a v1.0 watch extension.
Create a new target and choose watch OS > Application.
After uploading the iPhone App to the Appstore, how will the appstore handle the version compatibility of the devices ?
For example "Twitter" app, when clicking on "Install" it pop ups up with message saying "App is compatible in ios5"
How can this be done in my iPhone Application which I'm going to upload in AppStore ?
Will this be done by APPLE or do we need to code from our end.
It will get set automatically by the value you chose for your deployment target for your app. Check the build settings for your target.
Whenever you are using classes from a new SDK version and you are targeting an older versie of the OS you should check at runtime if a class is available.
For example:
if (NSClassFromString(#"TWTweetComposeViewController") != nil) {"
TWTweetComposeViewController *twViewcontroller = ....
} else {
// Some other twitter library
}
This is the save way to check support for a specific class.