Posts

Post not yet marked as solved
1 Replies
860 Views
My UI test is performed on iPhone 13 Pro 15.3.1, with Xcode 13.2.1. I have narrow down the issue as below two tests. The test code below just send a simple https request. I have allowed the network access for the test app on both Wifi and cell. And I'm a paid developer. All following two tests are passed in simulator but failed on iPhone, so it means something is wrong in iPhone side, but I couldn't figure out it. Need help, guys. The error exists with WiFi and Cellular. URLSession request is denied on both Wi-Fi interface and cellular interface. NSURLErrorNWPathKey=unsatisfied... 1st test: The test code is provided in Apple doc (https://developer.apple.com/documentation/xctest/asynchronous_tests_and_expectations/testing_asynchronous_operations_with_expectations). func testDownloadWebData() { // Create an expectation for a background download task. let expectation = XCTestExpectation(description: "Download apple.com home page") // Create a URL for a web page to be downloaded. let url = URL(string: "https://apple.com")! // Create a background task to download the web page. let dataTask = URLSession.shared.dataTask(with: url) { (data, _, _) in // Make sure we downloaded some data. XCTAssertNotNil(data, "No data was downloaded.") // Fulfill the expectation to indicate that the background task has finished successfully. expectation.fulfill() } // Start the download task. dataTask.resume() // Wait until the expectation is fulfilled, with a timeout of 10 seconds. wait(for: [expectation], timeout: 10.0) } 2nd attempt: I also try my version, but get the same result. func testDownloadWebData() { // Create an expectation for a background download task. let expectation = expectation(description: "Download apple.com home page") // Create a URL for a web page to be downloaded. let url = URL(string: "https://apple.com")! var request = URLRequest(url: url) request.httpMethod = "GET" let config = URLSessionConfiguration.default config.waitsForConnectivity = true let session = URLSession(configuration: config) // Create a background task to download the web page. let dataTask = session.dataTask(with: request) { (data, _, error) in // put a breakpoint here, no triggered. guard error == nil else { print(error!.localizedDescription) return } // Make sure we downloaded some data. XCTAssertNotNil(data, "No data was downloaded.") // Fulfill the expectation to indicate that the background task has finished successfully. expectation.fulfill() } // Start the download task. dataTask.resume() // Wait until the expectation is fulfilled, with a timeout of 10 seconds. wait(for: [expectation], timeout: 10.0) }
Posted Last updated
.
Post not yet marked as solved
2 Replies
1.1k Views
Today, I create a small app to try ShazamKit music detection ability in iOS 15. Follow a tutorial on Youtube, and I have Apple developer membership and have enabled the ShazamKit service for this app identifier. In short, I want to detect a song metadata with ShazamKit from the audio file inside app. The problem is that both of delegate method didFind and didNotFindMatchFor didn't fire though I have generated the signature successfully. I think it should give me an error in didNotFindMatchFor delegate method if there is no match found at least, but it doesn't. It's a pretty new feature, there is not that much related stuff I could find. What am I missing here? Appreciate for any help. More info: I do find some stuff using audioEngine, however that use output from Microphone, if user listen music with a headphone, that would be not possible. In my case I want to use the file itself since my production app is a music player, which stores a lot audio files in sandbox. import ShazamKit import UIKit class ViewController: UIViewController { lazy var recoButton: UIButton = { let button = UIButton(frame: CGRect(x: 0, y: 0, width: 120, height: 60)) button.layer.cornerRadius = 8 button.backgroundColor = .brown button.setTitle("Recognize", for: .normal) button.addTarget(self, action: #selector(recognizeSong), for: .touchUpInside) return button }() override func viewDidLoad() { super.viewDidLoad() view.addSubview(recoButton) recoButton.center = view.center } @objc func recognizeSong(_ sender: UIButton) { print("reco button tapped") // ShazamKit is available from iOS 15 if #available(iOS 15, *) { // session let session = SHSession() // delegate session.delegate = self do { // get track guard let url = Bundle.main.url(forResource: "Baby One More Time", withExtension: "mp3") else { print("url is NULLLL") return } // create audio file let file = try AVAudioFile(forReading: url) let frameCapacity = AVAudioFrameCount(file.length / 26) // Audio -> Buffer guard let buffer = AVAudioPCMBuffer(pcmFormat: file.processingFormat, frameCapacity: frameCapacity) else { print("Failed to create a buffer") return } // Read file into buffer try file.read(into: buffer) // SignatureGenerator let generator = SHSignatureGenerator() try generator.append(buffer, at: nil) // create signature let signature = generator.signature() // try to match session.match(signature) } catch { print(error) } } else { // unavailable alert } } } extension ViewController: SHSessionDelegate { func session(_ session: SHSession, didFind match: SHMatch) { print("Match found!") // get results let items = match.mediaItems items.forEach { item in print(item.title ?? "title") print(item.artist ?? "artist") print(item.artworkURL?.absoluteURL ?? "artwork url") } } func session(_ session: SHSession, didNotFindMatchFor signature: SHSignature, error: Error?) { if let error = error { print(error) } } }
Posted Last updated
.
Post not yet marked as solved
0 Replies
370 Views
A quick question. I use to see the inferred type by option click the property or object. After upgrade to Xcode 13, for instance, when I option click on below text property, there is no quick help popping up. Do u guys meet this same issue? Just Google it, no clue found. let text = "Have a nice day" Update Quick help is only showed up when I optional click on an iOS built-in property, functions, etc. It doesn't appear for custom defined things. For code below, when I optional click on viewDidLoad or addSubview , I could get quick help menu popped up. But without luck for tableView, which is a user defined stuff. private lazy var tableView: UITableView = { let table = UITableView() table.register(UITableViewCell.self, forCellReuseIdentifier: "cell") return table }() override func viewDidLoad() { super.viewDidLoad() view.addSubview(tableView) tableView.frame = view.bounds }
Posted Last updated
.
Post not yet marked as solved
3 Replies
743 Views
My app is a Movie app fetching data from TMDb API (https://apps.apple.com/app/id1507728382)When I submit an updation version to Apple Store, it reject me as following reason."Your app includes content that resembles celebrity images without the necessary authorization.To resolve this issue, it would be appropriate to remove the third-party content from your screenshots."It said that the screenshots in Apple connect is includes celebrity images and list all my five screenshots in the attachment. But I didn't change those screenshots in this new version, I just make some bug fix and add one view in this new version and they failed my app this time. So they passed it in the first version and failed it this time.I submit one appeal to explain however they fail my app again with same reason. What should I do now? Because that is a Movie App, it supposed to contains information about movies, like movie poster image, actor's image. I could see many of Movie app in app store, they are using movie & celebrity image in their screenshots too.
Posted Last updated
.
Post not yet marked as solved
5 Replies
613 Views
I'm going to publish my app to App Store.Well, my app is using networking to fetch data from TMDB API, but with only GET request, no user authentication. And it has Firebase Mobile Ads, which is a banner ads, that one requires networking too.So, does my app contains encryption in this case? Should I choose YES or NO for it. Appreiated for any hint or help!Apple said:"Export laws require that products containing encryption be properly authorized for export.Failure to comply could result in severe penalties."
Posted Last updated
.
Post not yet marked as solved
1 Replies
1.2k Views
My app's new version update get rejected for apple rule 5.2.1, here is message apple sent to me:" Hello,Thank you for your message.To resolve the 5.2.1 issue, you may want to either:attach documentary evidence in the App Review Information section in App Store Connector remove all protected album cover artworks in app icons, screenshots or previews without the necessary authorization.We look forward to continuing with the review of your app. "I was shocked that in the 1st and 2nd release I got passed. But they reject it suddenly in the 3rd release, does apple change its policy recently?Well, my app is a music player, for screenshots(5.5 inch, 6.5 inch) in the previews I used some album artwork covers and apple think I need the permission to provide.It is cleared, then I changed those screenshots with non-copyrights epic mp3 from "https://freepd.com/" which is declared as "available for commercial and non-commercial purposes" by their artist. But after my reply to apple saying about the changes and indicating the referenced website I used all those non-copyrights content, apple still send me the same email as above showed.So I get confused, I know removing those screenshots may fix the issue as apple mentioned, but maybe someday I will need to use some of 3rd party things, thus I want to figure out further that could I use those non-copyrights music album artwork in my app? Or how could I provide documentary evidence? Where could find it?
Posted Last updated
.