after new iOS 10.3 launched, In-Purchases functional stopped working in application suddenly. Actually, this method doesn't call anymore.
func requestDidFinish(request: SKRequest) {
if let receiptURL = NSBundle.mainBundle().appStoreReceiptURL {
if let receipt = NSData(contentsOfURL: receiptURL) {
handleReceipt(receipt)
}
}
Seems the connection to AppleStore is broken.
It was Apple issue, already fixed!
Related
I have the following code to detect my internet connection state
override func viewDidLoad() {
super.viewDidLoad()
internetStatus()
// Do any additional setup after loading the view.
}
func internetStatus(){
let nwPathMonitor = NWPathMonitor()
nwPathMonitor.start(queue: DispatchQueue(label: "network_monitor"))
nwPathMonitor.pathUpdateHandler = { path in
if (path.status == .satisfied){
if (path.usesInterfaceType(.wifi)){
print("wifi")
}
if (path.usesInterfaceType(.cellular)){
print("cellular")
}
}
if (path.status == .unsatisfied)
{
print("noConnection")
}
if (path.status == .requiresConnection){
}
}
}
This works fine but on iOs simulator I am unable to detect reconnects. When I disconnect "noConnection" is printed which fine but when I connect "noConnection" prints again. Is this some sort of bug or there is something wrong in my code
So this works fine on real device but on simulator it doesnot work. I am using macos Big Sur and XCode 12.5
My code is pretty straight forward.
I am not sure what is the issue and I am not able to find a solution.
var suggestions = [INShortcut]()
for component in components
{
if let userActivity = UserActivityGenerator.getUserActivity(component: component)
{
let shortCut = INShortcut.init(userActivity: userActivity)
suggestions.append(shortCut)
}
}
INVoiceShortcutCenter.shared.setShortcutSuggestions(suggestions)
The app crashes in setShortcutSuggestions.
It works fine in iOS 12 with same Xcode 11 Beta.
Execute the function in the main queue.
DispatchQueue.main.async {
INVoiceShortcutCenter.shared.setShortcutSuggestions(suggestions)
}
I'm testing out my code that starts an HKWorkoutSession collects samples and ends then saves the workout using the old HKWorkoutConfiguration API (not the new HKWorkoutBuilder API)....my understanding is that the previous API should still work.
However when testing in the watch simulator, starting and stopping a workout using Xcode 10 Beta 4 and 5, I noticed that I am able to start a workout and query samples, however when I call healthStore.stop there is a 5 or 6 second delay until the workout ends?
// Create workout configuration
let workoutConfiguration = HKWorkoutConfiguration()
workoutConfiguration.activityType = .running
workoutConfiguration.locationType = .outdoor
do {
workoutSession = try HKWorkoutSession(configuration: workoutConfiguration)
workoutSession?.delegate = self
} catch {
fatalError(error.localizedDescription)
}
func start(_ workoutSession: HKWorkoutSession) {
healthStore.start(workoutSession)
}
func end(_ workoutSession: HKWorkoutSession) {
healthStore.end(workoutSession)
}
Update 9/20/18: I filed a radar, it was marked as dup....as of Xcode 10 GM release this bug is still present. Confirmed this does NOT happen on device, only simulator.
I have searched enough but failed to get a solution.
I am using ReplayKit to record the screen of my app. I have started recording the screen by calling
let sharedRecorder = RPScreenRecorder.shared()
sharedRecorder.startRecording() { error in
if let error = error {
self.showScreenRecordingAlert(message: error.localizedDescription)
}
}
When I am pressing the stopRecord button I am calling
let sharedRecorder = RPScreenRecorder.shared()
sharedRecorder.stopRecording { previewViewController, error in
if let error = error {
self.showScreenRecordingAlert(message : error.localizedDescription)
return
}
}
But the issue that I am facing is, the program control does not enter inside the stopRecording block.
When I am doing po sharedRecorder.isRecording, it always returns false.
I have done everything I know but failed to get a solution.
If you having this above issue with your code i have found the solution for this.
let sharedRecorder = RPScreenRecorder.shared()
sharedRecorder.stopRecording { previewViewController, error in
if let error = error {
self.showScreenRecordingAlert(message : error.localizedDescription)
return
}}
Above Block will not call if you running your app on simulator so please use real device to test then above method will call definitely.
Thank you.
Just had this issue running XCode 9.4.1 and building onto iOS 11.4.0. Upgrading the phone to iOS 11.4.1 fixed the bug. I'm not sure if the difference in XCode versions is the root cause or if 11.4.0 was just broken.
I have the following code snippet for clearing user's clipboard:
func clearClipboard() {
let pb = UIPasteboard.generalPasteboard()
let pbtypes = pb.pasteboardTypes()
for pbtype in pbtypes {
pb.setValue("", forPasteboardType: pbtype)
}
print("Clipboard was cleared")
}
I tested the code on iPhone running iOS 8.4 and it works. However, on iOS 9.3 it doesn't work. On iOS 9.3, the pbtypes array is empty.
Did Apple change anything in the API permissions? Any advice will be appreciated.
So after more investigation it looks like this the way to clear the clipboard:
pb.setValue("", forPasteboardType: UIPasteboardNameGeneral)
Credit to this thread: How to clear/empty pasteboard on viewWillDisappear