Posts

Post not yet marked as solved
1 Replies
1.4k Views
I'm getting the following error in Xcode and I can't figure out how to fix it. Cannot load underlying module for 'MediaPlayer' I've searched Google and have come across lots of other people with similar issues whereby they're importing something and it's producing this error alongside it. https://stackoverflow.com/questions/76256875/cannot-load-underlying-module-for-scenekit https://developer.apple.com/forums/thread/115059 https://stackoverflow.com/questions/32673866/cocoapods-cannot-load-underlying-module-for-x The error is being shown inline with this bit of code: import SwiftUI import MusicKit import MediaPlayer <-- this line here I can build and run the project without issue and it disappears. But will quickly reappear again a short while later and it's very annoying. How can I resolve this please?
Posted Last updated
.
Post not yet marked as solved
3 Replies
1.2k Views
Hello. I'm developing an app that completely relies on an internet connection and as such I want to know if there's a way to check if the iPhone has an active internet connection available because if it doesn't, I want to display a different view to the user stating that the app doesn't have an internet connection and so the app cannot be used. This is a feature that exists in first party Apple apps like the App Store and also third party apps such as YouTube. Does anyone know of an effective way to achieve this please?
Posted Last updated
.
Post not yet marked as solved
0 Replies
476 Views
My application's music/media player is defined in my app as: @State var musicPlayer = MPMusicPlayerController.applicationMusicPlayer I want to change the playback rate and increase it slightly, but I'm unsure how to do this. The documentation is here which states it's part of the MPMediaPlayback protocol but I'm unsure how I can get this to work together. I tried doing the following: self.musicPlayer.currentPlaybackRate(1.2) But I just get the following error: Cannot call value of non-function type 'Float' When I play a song (self.musicPlayer.play()), how can I set the playback rate at the same time please?
Posted Last updated
.
Post not yet marked as solved
1 Replies
754 Views
Hi, I was looking through the APIs, specifically for Apple Search Ads and saw that there seems to be an API available for this but I can't work out if you can get data from Search Ads Basic or if it's just for Search Ads Advanced. Does anyone know if this API exposes data from the basic version of ASA or is it just for data held within the advanced version? Documentation: https://developer.apple.com/documentation/apple_search_ads Thanks
Posted Last updated
.
Post not yet marked as solved
1 Replies
544 Views
I'm trying to build and run my project but it's stuck and not doing anything although it's making my MacBook Pro work overtime due to the noise it's making. I've checked Activity Monitor and the swift-frontend process is at 99.3% CPU. Is there something I can do? I tried restarting my Mac, I tried restarting Xcode, I tried killing the processes and it seems to now be completely stuck.
Posted Last updated
.
Post not yet marked as solved
0 Replies
1.3k Views
Hi, I'm trying to work with WidgetKit and get my widget to update once every hour and I'm having trouble figuring out how to do this. Mainly because I don't quite understand the concept of adding entries into a timeline. If I'm updating once an hour, cannot I not just add one entry that expires after an hour? Anyway, I've got my widget setup but I'm trying to get the timeline part working. This is the code I have in my widget app, which was mostly populated by the default widget boilerplate you get when you create it. How can I make my widget update once, every hour?     func getTimeline(in context: Context, completion: @escaping (Timeline<Entry>) -> ()) {         var entries: [ScoreEntry] = []         let currentDate = Date()         for hourOffset in 0 ..< 6 {             let entryDate = Calendar.current.date(byAdding: .hour, value: hourOffset, to: currentDate)!             let entry = ScoreEntry(date: entryDate, score: playerScore)             entries.append(entry)         }         let timeline = Timeline(entries: entries, policy: .atEnd)         completion(timeline)     }
Posted Last updated
.
Post not yet marked as solved
0 Replies
557 Views
Hi, I'm trying to submit a new version of my app to app review and it got rejected. I had a look at the rejection and it says that I need to submit my IAP with my app binary. The only problem is... I have no idea how to do that. My IAP is currently stuck on 'Developer Action Needed' and the button to submit for review is greyed out and disabled so I can't click it. I tried to follow this guide; https://help.apple.com/app-store-connect/#/dev1986a0e5c and I don't even have the IAP section underneath the builds to attach an IAP in the first place. I've looked at these questions for support and none of them provide any indication as to why my app was rejected and seemingly I can't submit a new IAP: https://developer.apple.com/forums/thread/47112 https://developer.apple.com/forums/thread/116844 https://developer.apple.com/forums/thread/111998 https://developer.apple.com/forums/thread/23787 Can someone help me with at all, please?
Posted Last updated
.
Post not yet marked as solved
2 Replies
1.6k Views
I'm completely lost with StoreKit. I just want to add a button that people can click on and pay a small fee and that's it. Nothing else. I've tried looking at the StoreKit sample code here: https://developer.apple.com/documentation/storekit/in-app_purchase/implementing_a_store_in_your_app_using_the_storekit_api The sample code doesn't explain how to actually take the code apart and implement it in a simple way. How can you have one single product that you can buy by pressing a button? Here is my code in Store.swift. import Foundation import StoreKit typealias Transaction = StoreKit.Transaction public enum StoreError: Error {     case failedVerification } class Store: ObservableObject {          @Published var products: [Product] = []     @Published var purchasedProducts: [Product] = []          let productList: [String: String]     init() {         if let path = Bundle.main.path(forResource: "Products", ofType: "plist"),         let plist = FileManager.default.contents(atPath: path) {             productList = (try? PropertyListSerialization.propertyList(from: plist, format: nil) as? [String: String]) ?? [:]         } else {             productList = [:]         }         products = []         Task {             await fetchProducts()         }     }          @MainActor     func fetchProducts() async {         do {             let storeProducts = try await Product.products(for: productList.keys)             var newProducts: [Product] = []             for product in storeProducts {                 newProducts.append(product)             }         } catch {             print("Failed product request from the App Store server: \(error)")         }     }     func isPurchased(_ product: Product) async throws -> Bool {         return purchasedProducts.contains(product)     }          func purchase(_ product: Product) async throws -> Bool {         let result = try await product.purchase()         switch result {             case .success:                 print("Product has been purchased.")                 return true             case .userCancelled, .pending:                 return false             default:                 return false         }     }     func checkVerified<T>(_ result: VerificationResult<T>) throws -> T {         switch result {         case .unverified:             throw StoreError.failedVerification         case .verified(let safe):             return safe         }     }     @MainActor     func updateProductStatus() async {         var purchasedProducts: [Product] = []         for await result in Transaction.currentEntitlements {             do {                 let transaction = try checkVerified(result)                 if let product = products.first(where: { $0.id == transaction.productID }) {                     purchasedProducts.append(product)                 }             } catch {                 print()             }         }         self.purchasedProducts = purchasedProducts     }      } This is what I have in my view within my app.                     Section(                         header: Text("Products")                     ) {                         ForEach(store.products) { product in                             Button(                                 action: {                                     // Nothing.                                 },                                 label: {                                     Text("Product: " + product.displayName)                                     Spacer()                                     Text(product.displayPrice)                                 }                             )                         }                     } When I run the app, it builds successfully but it just shows the section heading and then it's blank underneath. What am I doing wrong here which means that my product is not loading? I have; added the in-app purchase capability in my app added the product into a plist file in my app added the product into my app within App Store Connect added my products into the product config file in Xcode added the state object reference at the top of my view added the StoreKit scheme to my app I don't think I've missed anything else out here. Can someone please help me with where I'm going wrong? I've read so many tutorials and watched so many videos and they literally all explain it a different way.
Posted Last updated
.