registerForRemoteNotifications not working at all in Big Sur? - apple-push-notifications

I am working on a macOS app that involves remote notifications. In my app delegate appDidFinishLaunching, I simply call
NSApplication.shared.registerForRemoteNotifications()
I then get one of two callbacks in the app delegate, either didRegisterForRemoteNotificationsWithDeviceToken or didFailToRegisterForRemoteNotificationsWithError. This has worked fine forever in previous versions.
In Big Sur, this does not seem to work at all. I call the registerForRemoteNotifications, but I never get either callback called.
My hypothesis was that this is because of the new app lifecycle (which is where I originally tried this out). I built a small test app with AppKit app delegate lifecycle. It is equally broken there.
What gives? Why cannot I register for remote notifications in Big Sur?

It seems to be fixed in 11.3 Beta (20E5186d).

This was only broken in the development environment. It was always working as expected in production environment, but it was of course difficult to develop and test with this.
This was fixed in one of the minor versions of Big Sur. I am now using 11.5.1 and it is working now as expected in all environments.

Related

Electron Debugging

I have an Electron app in the Mac AppStore that is essentially just a wrapper around a hosted web app. A few months ago one specific thing has stopped working in this app. I'm using redux-offline to sync changes to the server and this is just not happening any more.
It's working when running it outside of Electron - in any modern browser.
All other requests are working fine.
It's working when debugging it locally.
It's working when running the built version locally.
BUT it fails in the published Mac App Store version. I'm not catching any errors in my logs (server-side or client-side). I just upgraded to the latest Electron (electron#4.1.4, electron-packager#13.1.1) hoping it would solve it - to no avail. I don't even know how to properly debug it since it's only failing in the published version.
Any ideas? On causes, solutions or ways to debug it?
Seems like your application closes by itself. Check all of app.quit executions. For me issue was that app.requestSingleInstanceLock() returns the wrong value for Mac Store build. Please check this issue, if the problem is related to app.requestSingleInstanceLock().

With XCode 8 How Do I Target My App To Run on macOS also (it already runs on iPhone / iPad)?

Can someone show me what I change in my project in XCode so that my app will also deploy to a Mac?
For example, I'm running a Mac Mini but I cannot seem to run my app on the actual Mac, even though it is a Universal app and runs on both iPhone and iPad platforms. My app is already deployed to the app store ( https://itunes.apple.com/us/app/cyapass/id1183137527?mt=8 ) and I've tried to install it to the Mac that way, but that doesn't work either.
Is this possible through a simple change in the XCode project?
Or, do I have to create a new project that targets the Mac specifically?
If you have screenshots from XCode those would be greatly appreciated if the change is made in the XCode project.
Unfortunately, there are some frameworks which are not applicable for OS X that iOS development depend on, such as the UIKit. You can see the full list here.
Chameleon, once done, can hopefully make the transition from iOS to OS X easier.
Although, you won't necessarily need to create a new XCode Project, as you can share the common frameworks and logic in-between the two platforms.
You could essentially structure your code like so (inspired by another SO post)
- Workspace
- Shared Code
- File1.m Target: iOS and OSX
- iOS
- File2.m Target: iOS
- OSX
- File3.m Target: OSX
It is although important when doing so to set the appropriate targets of each individual file.
Last but not least, Apple has previously, during WWDC13, given a talk about how to bring iOS Apps to OS X. Note that the talk can only be seen using either the WWDC App or Safari. I have previously found this talk helpful myself once I needed to implement an OS X version of an existing iOS app.
Is this possible through a simple change in the XCode project?
No, it isn't. AppKit and UIKit are utterly different from one another. Even common frameworks such as Core Graphics have different APIs. Basically, you just have to rewrite the app. Your core logic (the model) can be in common, but the workings of the iOS app and the macOS app will be completely separate codebases.

Remove support for Apple Watch on app store

I removed the embedded app extension for my watch app, and the target dependency so that my app would discontinue support for the apple watch.
The app never quite worked, and the more my app evolves the less the apple watch does for the user.
After removing these things I attempted to install the build on my phone. It never was able to do so, until I deleted it.
I tested this using testflight.
The app won't install. It downloads, then sits at about 90%. Will NOT update
How then am I to remove support for the apple watch????
This answer may seem weird as it does not have to do with apple watch at all, but I have had the issue you've had with installs not finishing before. I was really stumped as to what it could be, looking into all of my extensions as you are doing now.
It ended up being that I had placed leading zeros in the version number/build number.
For example: Version 4.01
Instead of: Version 4.1
For some reason this caused the error you described for me. Can you confirm you don't have any leading zeros?

Xcode 4 Scheme Hell?

I have a serious ongoing issue with Xcode 4. I have been using Xcode 3 for years, and had everything set up perfectly. All my Build Configurations worked A-OK.
I updated to iOS 5 GM, and naturally I have to use Xcode 4 to submit my app to the Store or use TestFlight. I can't change my Build Configuration. I've tried making a new "Scheme" (which are stupid IMHO, when the old system worked 100%), and everytime I do, I set everything the same, I go "Product" > "Archive"....it works, and I share the IPA to my Desktop, to upload it to TestFlight, or I save it as a ZIP and send it to Application Loader.
IT NEVER WORKS. On TestFlight, my testers will install it, and immediately the application will crash. It won't even launch, no matter how I build the app, regardless of Scheme. It worked 100% and I have made ZERO changes since updating to Xcode 4.
Xcode 4 only works when I wish to "Debug" my app on my own device. It builds, installs and runs perfectly. Why won't it work on AdHoc or App Store?
PLEASE HELP! I'm ready to pull my hair out.
To answer this question, it was an absolutely STUPID issue!
I was checking the size of my Info.plist for any changes, and for some ridiculous reason only Apple can comprehend, updating to iOS 5 made that code obsolete. So the use of the code in my Release/AppStore/AdHoc builds was making it crash on launch. Once I commented the code out, everything is back working 100%.
Strange.
Even Apple Technical Support couldn't figure it out and they had my whole project to peruse. Apple REALLY need to improve their software when they change it. Not create a massive learning curve for their users and encourage code-cleanups if the SDK decides it doesn't like 4.3 code.

XCode 3.2.4 iOS 4.1 (Final) and CoreData Crashes in Simulator

I've got 2 applications using Core Data with a sqlite persistent store. I've got a data loader routine that I run to populate the CoreData DB from csv files. During development, when my data changes I run the routine from the simulator to generate new databases and copy the new one into the project.
This has been working quite well for XCode 3.2.3 and iOS 4.0. It even works in the XCode 4 Preview 2 and 3. I just installed the final version of XCode 3.2.4 and iOS 4.1. Now my db loader fails. It gives me no message, no warning, no nothing. It just dumps out to the spring board and XCode gives me the "Debugging Terminated" message. It will fail at different times during the load so I'm pretty sure it's not a data issue. I'm not doing any threading. I assume the issue has to do with either Core Data or sqlite, since that's when the crash occurs, but with no info reported I can't tell for sure.
I uninstalled everything. Xcode 3.2.4, Xcode 4 preview (assuming it was an issue caused by XCode 4) and reinstalled XCode 3.2.3/iOS 4.0. Things returned to normal. After getting some work done I attempted to upgrade to 3.2.4/iOS 4.1 again. I uninstalled 3.2.3/iOS 4.0, rebooted. Installed 3.2.4/iOS 4.1, rebooted and tried again. No luck. Same hard crash. Same lack of messaging as to the cause.
I have determined that this only happens with the Simulator with XCode 3.2.4, the device is fine as is XCode 4 and 3.2.3. I've tried playing with the target OS selection (3.0,3.1,4.0,4.1). I've tired adjusting the Compiler from GCC 4.0, GCC 4.2,LLVM GCC 4.2, LLVM 1.5. I've tried setting the Base SDK to iOS Simulator 4.1. Interestingly enough it will work in the iPad simulator when using the 3.2 SDK. So I've at least go that as a work around.
I guess there is one of 3 issues:
An issue with my code that has been uncovered by 3.2.4.
Bug in 3.2.4.
A configuration issue that I've missed.
If anybody has any troubleshooting ideas or answers I'd love to hear them. I've been doing iOS full time since V 2.1 and I am seriously stumped.
Thanks in advance,
I figured out my issue. It looks like the CoreData/Sqlite connection was a total red herring. Following a tip I read on SO, I used OSX's Console application and got a critical message "Failed to launch in time" that was not being displayed in XCode's debugger console.
It looks like the process was being killed due to what is essentially a timeout error. The iPhone will kill an application that takes too long to complete "didFinishLaunching." That's where I was kicking the data load routine off from. The new version of XCode must have adjusted it's timeout values.
So my takeaway is give OSX's console a shot if XCode isn't telling you everything and watch out for those red herrings.
When I upgraded I ran into troubles in the simulator when saving the managedObjectContext. I finally deleted my sqlite CoreData store file and have not run into similar problems. Try deleting your data file (well save a copy of it before deleting to see what is different).

Resources