小编Gar*_*abo的帖子

App Store Connect 操作错误:关键 com.apple.developer.healthkit.access 的 ITMS-90164 []

我现在在尝试上传到应用商店时遇到此错误,但我没有对我的 healthkit 功能进行任何更改,而且一切看起来都很好(参见图片)。为什么说价值是[] 在此处输入图片说明

<

?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>aps-environment</key>
    <string>development</string>
    <key>com.apple.developer.healthkit</key>
    <true/>
    <key>com.apple.developer.healthkit.access</key>
    <array/>
    <key>com.apple.developer.icloud-container-identifiers</key>
    <array>
        <string>iCloud.codes.myndarc.newFitnessApp</string>
    </array>
    <key>com.apple.developer.icloud-services</key>
    <array>
        <string>CloudKit</string>
    </array>
    <key>com.apple.security.application-groups</key>
    <array>
        <string>group.com.myndarc.newFitnessApp</string>
    </array>
</dict>
</plist>
Run Code Online (Sandbox Code Playgroud)

在此处输入图片说明

ios swift healthkit app-store-connect

17
推荐指数
1
解决办法
1815
查看次数

如何检查HealthKit是否已获得授权

我想检查HeathKit是否已被授权我读取用户的数据,如果我被授权进行训练,如果没有弹出警报.但requestAuthorizationToShareTypes似乎总是返回true?如何获得用户是否授权我的参考?

override func viewDidLoad() {
        super.viewDidLoad()

        //1. Set the types you want to read from HK Store
        let healthKitTypesToRead: [AnyObject?] = [
            HKObjectType.workoutType()
        ]


        //2. If the store is not available (for instance, iPad) return an error and don't go on.

        if !HKHealthStore.isHealthDataAvailable() {
            let error = NSError(domain: "com.myndarc.myrunz", code: 2, userInfo: [NSLocalizedDescriptionKey: "HealthKit is not available in this Device"])
                print(error)

            let alertController = UIAlertController(title: "HealthKit Not Available", message: "It doesn't look like HealthKit is available on your device.", preferredStyle: …
Run Code Online (Sandbox Code Playgroud)

ios swift healthkit

16
推荐指数
3
解决办法
7347
查看次数

在iPhone上的Spotify中播放当前歌曲

访问MPMusicPlayerController.systemMusicPlayer()(下面的代码)有助于获取Apple Music应用程序中正在播放的内容的跟踪信息,但有没有办法可以访问Spotify应用中播放的当前歌曲的信息?

这个代码张贴在这个答案我需要知道如何获取有关该玩家当前流(播放器,Spotify的,Napster公司...)信息使用MPNowPlayingInfoCenter是无是否使用苹果公司的音乐或Spotify的等.

  let player = MPMusicPlayerController.systemMusicPlayer()

    @IBAction func getMusicButton(_ sender: UIButton) {




        if let mediaItem = player.nowPlayingItem {
            let title: String = mediaItem.value(forProperty: MPMediaItemPropertyTitle) as! String
            let albumTitle: String = mediaItem.value(forProperty: MPMediaItemPropertyAlbumTitle) as! String
            let artist: String = mediaItem.value(forProperty: MPMediaItemPropertyArtist) as! String

            print("\(title) on \(albumTitle) by \(artist)")
        }

    }
Run Code Online (Sandbox Code Playgroud)

spotify ios swift

12
推荐指数
1
解决办法
1798
查看次数

containerAppExtensionEntitlementsWithCompletion失败,错误:(null)

我在我的手表应用程序的控制台中收到此错误,我无法弄清楚它与之相关的内容,也没有找到任何其他帖子或文档.其他人都知道吗?

完整信息是2017-12-02 18:31:01.379382-0500 Watch Extension [1308:33925] [default] containerAppExtensionEntitlementsWithCompletion:失败并显示错误:(null)

xcode ios apple-watch watchkit watchos-4

10
推荐指数
1
解决办法
1049
查看次数

SwiftUI 有没有办法检测用户是否启用了较大的文本大小?

我已阅读所有有关支持动态文本大小的文章,但我的问题是我有一个由形状和一些文本组成的视图。我需要对此视图的高度进行硬编码,因此当用户使用较大的文本大小时,文本会与形状重叠。我想做的是检测何时使用较大的文本大小并增加视图的硬编码高度。

swift swiftui

10
推荐指数
1
解决办法
3758
查看次数

SwiftUI 如何跟踪 PageTabViewStyle 中的页面索引?

我试图跟踪用户在 SwiftUI 中所在的页面,TabViewPageTabViewStyle我无法找出跟踪页面索引的最佳方法?using.onAppear效果不佳,因为它会被多次调用,并且即使不在屏幕上,页面 2 和 3 也会被调用。

@State var pageIndex = 0

    var body: some View {
    VStack {
        Text("current page = \(0) ")
        TabView {
            Text("First")
                .onAppear {
                    pageIndex = 0
                }
            Text("Second")
            .onAppear {
                    pageIndex = 1
                }
            Text("Third")
            .onAppear {
                    pageIndex = 2
                }
        }
         .tabViewStyle(PageTabViewStyle(indexDisplayMode: .never))
         }
    }
}
Run Code Online (Sandbox Code Playgroud)

ios swift swiftui swiftui-tabview

10
推荐指数
1
解决办法
6798
查看次数

Xcode 15 锁定我的应用程序运行:1 日志/路标消息由于实时模式记录的高速率而丢失?

这只是今天在 Xcode 15 中开始的。我还没有添加任何新的日志或打印语句,但是当我在 iPhone 14 Pro 上构建并运行时,我点击应用程序中的视图,控制台正在打印:

1 条日志/路标消息由于实时模式录制中的高速率而丢失。为了保证所有日志的传送,请在可执行文件的环境中将 IDELogRedirectionPolicy 设置为 oslogToStdio。

无数次。当我在 iPhone 13 mini 上构建并运行完全相同的代码时,它不起作用?

xcode ios xcode15

10
推荐指数
2
解决办法
4550
查看次数

仅在Apple Watch上请求位置,而在配对的手机上没有代码

我到处都看,包括Apple的示例应用程序.但是当我可以在不需要在电话上运行任何代码的情况下请求位置时,我找不到任何地方,在"接口控制器"中使用下面的代码返回"未确定"状态.我确实检查了我的info.plist是否设置了隐私密钥值.

import Foundation
import CoreLocation

class LocationManager: NSObject, CLLocationManagerDelegate {

    /// Location manager to request authorization and location updates.
    let manager = CLLocationManager()

    /// Flag indicating whether the manager is requesting the user's location.
    var isRequestingLocation = false

      var workoutLocation: CLLocation?

    func requestLocation() {

        guard !isRequestingLocation else {
            manager.stopUpdatingLocation()
            isRequestingLocation = false
            return
        }

        let authorizationStatus = CLLocationManager.authorizationStatus()

        switch authorizationStatus {
        case .notDetermined:
            isRequestingLocation = true
            manager.requestWhenInUseAuthorization()

        case .authorizedWhenInUse:
            isRequestingLocation = true
            manager.requestLocation()

        case .denied:
            print("Location Authorization Denied") …
Run Code Online (Sandbox Code Playgroud)

core-location ios swift apple-watch

9
推荐指数
2
解决办法
1320
查看次数

Xcode 15 Beta 8:WidgetKit #Preview 宏停止工作:

Xcode 15 Beta 8 中的 #Preview 宏的使用方式是否发生了变化?该代码曾经工作正常,但现在不再编译,因为== PREVIEW UPDATE ERROR: CompileDylibError: Failed to build WatchRecoveryWidget.swift Compiling failed: cannot convert value of type 'WatchRecoveryScoreTimeLineEntry' to closure result type 'any View'

  #Preview(as: WidgetFamily.accessoryRectangular) {
    WatchRecoveryScoreWidget()
} timeline: {
    WatchRecoveryScoreTimeLineEntry(date: Date(), recoveryScore: 75, subscriptionIsActive: true)
}
Run Code Online (Sandbox Code Playgroud)

xcode widgetkit watchos xcode15 swift-macro

9
推荐指数
1
解决办法
547
查看次数

SwiftUI 如何在没有列表的情况下使用 .refreshable 视图修饰符?

iOS 15 引入了“.refreshable”视图修饰符,但我见过的大多数示例都使用List. 我想在一个不使用列表而仅VStack使用Text如下视图的应用程序中实现拉动刷新功能。我该如何实现这一点,以便下拉刷新将刷新我的数据?

import SwiftUI

struct ContentView: View {

@State var songName = "Song"
@State var artistName = "Artist"

    var body: some View {
        VStack {
            Text(songName)
            Text(artistName)
        }
        .refreshable {
            reloadData()
        }
    }
    
    private func reloadData() {
        
        songName = "Let it Be"
        artistName = "The Beatles"
    }
}

struct ContentView_Previews: PreviewProvider {
    static var previews: some View {
        ContentView()
    }
}
Run Code Online (Sandbox Code Playgroud)

ios swift swiftui ios15 refreshable

8
推荐指数
0
解决办法
991
查看次数