I have added dark, tinted and light version for my app icon, it only works on the simulator but when I run the app on a real device it doesn't work at all and only display the default light icon.
Post
Replies
Boosts
Views
Activity
I am trying to use the new @Entry macro to add new EnvironmentValues as the documentation: https://developer.apple.com/documentation/swiftui/entry() say but I keep getting errors.
I am using iOS 17.4, Xcode 15.3.
I am trying to use AVAssetExportSession to export audio form video but every time I try it, it fails and I don't know why ?!
this is the code
import AVFoundation
protocol AudioExtractionProtocol {
func extractAudio(from fileUrl: URL, to outputUrl: URL)
}
final class AudioExtraction {
private var avAsset: AVAsset?
private var avAssetExportSession: AVAssetExportSession?
init() {}
}
//MARK: - AudioExtraction conforms to AudioExtractionProtocol
extension AudioExtraction: AudioExtractionProtocol {
func extractAudio(from fileUrl: URL, to outputUrl: URL) {
createAVAsset(for: fileUrl)
createAVAssetExportSession(for: outputUrl)
exportAudio()
}
}
//MARK: - Private Methods
extension AudioExtraction {
private func createAVAsset(for fileUrl: URL) {
avAsset = AVAsset(url: fileUrl)
}
private func createAVAssetExportSession(for outputUrl: URL) {
guard let avAsset else { return }
avAssetExportSession = AVAssetExportSession(asset: avAsset, presetName: AVAssetExportPresetAppleM4A)
avAssetExportSession?.outputURL = outputUrl
}
private func exportAudio() {
guard let avAssetExportSession else { return }
print("I am here \n")
avAssetExportSession.exportAsynchronously {
if avAssetExportSession.status == .failed {
print("\(avAssetExportSession.status)\n")
}
}
}
}
func test_AudioExtraction_extractAudioAndWriteItToFile() {
let videoUrl = URL(string: "https://storage.googleapis.com/gtv-videos-bucket/sample/ForBiggerMeltdowns.mp4")!
let audioExtraction: AudioExtractionProtocol = AudioExtraction()
audioExtraction.extractAudio(from: videoUrl, to: FileMangerTest.audioFile)
FileMangerTest.tearDown()
}
class FileMangerTest {
private static let fileManger = FileManager.default
private static var directoryUrl: URL {
fileManger.urls(for: .cachesDirectory, in: .userDomainMask).first!
}
static var audioFile: URL {
directoryUrl.appendingPathComponent("audio", conformingTo: .mpeg4Audio)
}
static func tearDown() {
try? fileManger.removeItem(at: audioFile)
}
static func contant(at url: URL) -> Data? {
return fileManger.contents(atPath: url.absoluteString)
}
}
I was wondering how can I detect if a certain day have events using EventKit, without fetching the events. To display something like that:/Users/eng.omarelsayed/Downloads/IMG_D9B141B15D79-1.jpeg
the dots under each day, which represent that this day contain event in it.
I started to use the EventKit APi and I like it so much but one missing thing is that I am trying to detect if the event is online or not. so if the event is online I will display something like apple does if not I will display the location od the event.
my app was rejected by this reason:
While we appreciate that your app is intended primarily for use on iPhone, in order to bring your app into compliance with App Store guidelines, all apps designed for use on iPhone must still be formatted correctly and behave properly when run on iPad.
How can I solve this problem without adding iPad as a destination in Xcode.