Hi Sam, I dowloaded and opened uour demo project for this screencasr in xcode 8. It does not compile - 31 errors.
What am I doing wrong?
Best,
David
Hi @david_ben_yosef,
The reason that you’re seeing all these errors is that this video was one of the first I made about iOS 10 - with one of the really early betas. Since this came out, there have been major changes to both iOS 10 and Swift 3, which have unfortunately broken the sample project.
I don’t think it should be too difficult to update the project to the latest Swift 3 syntax. Xcode might be able to help with some of the errors, and it’ll certainly try and point the rest of them out.
As it happens I’m going to give a talk on this topic at iOSConfSG next week, so will be taking this code, adapting it and updating it. I’ll post a link to the updated code on Twitter, so if that’ll be helpful, you’ll be able to grab hold of that in the next week or so.
Hope that’s helpful
sam
Thanks Sam, I’ll wait for the updated code. Do you know if there will be access to the IOSConfSG videos online after the event?
Hi @david_ben_yosef - I don’t know about videos, sorry.
FYI, I’ve put the updated code in the CuddlePix directory here:
This is the repo that accompanies the talk, so there might well be a few changes coming, but they won’t be that significant.
sam
Hi Sam,
Thanks again for your screencasts and videos on iOS 10 new notifications - these were very helpful to get me started on this. The videos of the conference can be found in Engineers.SG, if anyone is reading this thread.
One comment:
When setting auto-layout constraints for the content extension, I found that if I pin the bottom of the image view to the bottom layout guide as you did, while constraining the image view’s height and width, it creates layout conflicts. I think it is related to the fact that this view is resized by the system to accommodate any custom actions so they are visible. The solution was to remove that image view bottom constraint.
David
1 Like
Glad you enjoyed it David. And thanks for the tip!
sam
Hi, Sam:
When testing in old iDevice such like iPhone 5,
everything about custom notification is limited.
besides no 3d-touch, drag down won’t trigger
content extension, and "" star my cuddle "
leads to nothing.
Is there anything a developer can do for the
old machines which are “upgrade” to
the new “iOS 10”?
Thanks.
Hi @tomhawk
I’m very surprised that the custom notifications don’t work on an iPhone 5 running iOS 10. Does your code definitely work on other iOS devices? I see no reason that they shouldn’t work on an iPhone 5.
I’m not sure what to recommend if this is the case either. If the new UserNotifications
framework is working on an iPhone 5 then maybe custom UI isn’t supported. It’s worth confirming that you project does work on other devices though.
Also, check out the code that came with iOS 10 by Tutorials (the book). This might well have been updated compared to the (non-updated) code I wrote as part of these screencasts.
Hope that helps
sam
Sorry for resurrecting this thread after such a long time, @samdavies, but I’m in need of just a touch of clarification.
One thing wasn’t super clear at first, but I think I understand after watching the videos a few times, watching the WWDC 2016 videos on the subject, and reading the Apple Developer documentation.
But I wanted to ask for clarification, just to make sure.
Originally I was under the impression that Notification Service Extensions and Notification Content Extensions were basically entirely separate things — but after going over this a few times it seems like if we want to display an image that needs to be downloaded from a remote server, we’ll need to employ a Notification Service Extension to do the downloading part, and then do the technique with the startAccessingSecurityScopedResource()
from the sandbox after we’ve downloaded it with the Service Extension. Is that a correct assessment?
This series is really helpful for coming up to speed quickly on User Notifications (even if things have changed a bit in iOS 12)! Thanks for putting the screencasts together!
I think I may have answered my own question, and it appears the answer is yes.
In doing some testing with an already-existing Service Extension that performs the downloads of the necessary media files, it appears to do the heavy lifting of downloading the media files.
This is great, because it means that that work is done and functioning correctly. So at this point I just have to take the media file from the sandbox and display it based on what kind of file it is.
But if I have to download other content by hitting a web API, I’m guessing that I’ll have to do that in the Notification Service Extension as well, and modify the payload based on what comes back from the API call… and then I can retrieve all of that data (including the media file) when the Notification Content Extension activates.
These things were not at all clear from the WWDC videos and their documentation. Apple really made them feel like separate things, not interlocking pieces to achieve the goal of custom notifications.
Hi @interactivelogic
It’s been a long time since I worked on this, but I believe what you’re saying is correct. That you don’t want to be doing any downloading during the display phase of your custom notification. So the service extension is the place to prep all the expensive bits you need.
Well, that’s what I remember from iOS 10. I’m not sure what’s happened since then I’m afraid…
Sorry not to be of more help
sam
No, that’s great, @samdavies – very helpful. Thanks for getting back to me, and I believe that is correct as well, given the tests that I’ve been doing so far. Thanks again! -Evan
1 Like