Closed rv888 closed 5 years ago
Hi @rv888, right now you cannot add the dynamic query string to the custom URL. Can you tell me your use case?
Our app users will be logged in through the app itself. When they discover a beacon and click the notification, the custom url will appear. On this custom url will be a button to "Save" the offer they see to their account. We need to know who the logged in app user is that is viewing the custom url. My idea was to pass a token or similar as a querystring to the custom url that would signal who the app user is that is viewing the offer. Is there some other way I would be able to know this information at the custom url?
@sachinmobstac Any ideas for my problem? Thanks
@rv888, Are you talking about the campaign which is running the Custom URL?
In the iOS SDK. Option 1) On Custom url display, add a query string to it. Or option 2) if any data inside the app is made available to the custom url view in the sdk. @sachinmobstac
@rv888, Right now we don't have any method to do it. The standard security recommendation would be to expose a method which will allow you to set the cookies for a particular domain. This way your site can read the values from cookies. Does this sound better?
@rv888, Is the above fine or do you have any other thoughts?
iOS side, how can we set the cookies for the SafariViewController? It doesn't look like there is any exposed instance of the safari view controller for us to work with.
actually it looks like it is not possible to set cookies from the iOS app to the SFSafariViewController: https://forums.developer.apple.com/thread/7713
@sachinmobstac how would we do this based upon what @JoeyBodnar is saying?
@rv888 @JoeyBodnar, Which authentication mechanism is used in the app to sign in a user?
@sachinmobstac The app reaches out to a webserver for authentication. A token is returned for the active user inside the app. All actions inside the app uses this token to interact back with the webserver.
@rv888, Thanks for the information. The SafariViewController and Safari don't share cookies. There is a way to share cookies if you use SFAuthenticationSession. I will discuss with my team and let you know about the implementation.
the documentation says SFAuthenticationSession is deprecated (https://developer.apple.com/documentation/safariservices/sfauthenticationsession) and we should use ASWebAuthenticationSession?
@JoeyBodnar, I know it is deprecated, it is available from iOS 12. We need to support both hence mentioned the older ones. Since you are not using it for authentication we cannot do much with sharing cookies.
@sachinmobstac Is there no other way to pass a variable through the custom url setup? If we can't do that, then it's going to be a show stopper for us.
so would we have to use our own custom WKWebView then, instead of SafariViewController? @sachinmobstac is there a way to easily override the default behavior?
@rv888 @JoeyBodnar, We will be releasing a new version tomorrow which allows you to add additional parameters before opening the URL.
@sachinmobstac Thank you! Much appreciated. Please let us know when it's available.
ok great! thanks a lot. just let me know when it is released and I will import the new version to the Xcode project.
@rv888 @JoeyBodnar, We have updated the NearBee (1.1.6) which now has
overloaded methods checkAndProcessNearbeeNotification
and displayContentOf
which lets you add query parameters.
alright cool, implementing now
@sachinmobstac is it possible to compile the NearBee.framework file in Swift 4.2.1? I am receiving the error "Module compiled with Swift 5.0 cannot be imported by the Swift 4.2.1 compiler." It looks like the other 3 frameworks (EddyStone, SocketIO and Starscream) have been compiled with 4.2.1, and since this is a precompiled framework, I cannot change the Swift Language version in Build settings for it.
@sachinmobstac
if the compiled swift language version of the frameworks can be synced, please let me know.
@JoeyBodnar, Is it possible for you to use CocoaPods?
@sachinmobstac I just tried cocoapods but it crashes on launch with the error "library not loaded", the same error I received when I tried integrating using cocoapods a few weeks ago. This is the error:
Also, I have replicated this error in a brand new Xcode project, and pushed it to Github as well: https://github.com/JoeyBodnar/NearbeeCocoapodsTest
if anything in the project looks incorrect just let me know. But it is a brand new Xcode project that I just created and added the nearbee pod to.
My pod file:
platform :ios, '10.0'
target 'TestNearbeeApp' do
pod 'NearBee'
end
@JoeyBodnar,
Please replace with the below pods. I have to look into why it is not properly linking the frameworks.
platform :ios, '10.0'
target 'TestNearbeeApp' do
pod 'NearBee'
pod 'EddystoneScanner'
pod 'Socket.IO-Client-Swift'
end
ok will try now
I am receiving the same error message about "library not loaded" in both my project and the test project. I changed my podfile to be exactly as above and ran "pod install".
You are missing use_frameworks!
.
alright thank you! it compiles and does not crash on launch now. thanks a lot for the help!
for future visitors, my Podfile looks like this:
platform :ios, '10.0'
use_frameworks!
target 'MyApp' do
pod 'NearBee'
pod 'EddystoneScanner'
pod 'Socket.IO-Client-Swift'
end
what is the correct way to use the methods you gave above? Here is my current code:
let isNearBeeNotification = nearBee.checkAndProcessNearbyNotification(response.notification, queryParameters: ["authToken" : authToken])
if (isNearBeeNotification) {
completionHandler()
if let url = response.notification.request.content.userInfo["EddystoneURL"] as? String {
nearBee.displayContentOf(eddystoneUrl: url, queryParameters: ["authToken" : authToken])
}
}
but I was told that this causes the SafariViewControlller to segue to another url and it is just an empty screen. does this look correct?
// The below should be used only with the Notification
let isNearBeeNotification = nearBee.checkAndProcessNearbyNotification(response.notification, queryParameters: ["authToken" : authToken])
if (isNearBeeNotification) {
completionHandler()
}
// This should be used with the NearBeeBeacon.
let url = nearBeeBeacon.physicalWebEddystoneURL ?? nearBeeBeacon. eddystoneURL
nearBee.displayContentOf(eddystoneUrl: url, queryParameters: ["authToken" : authToken])
ok thank you. I will try this tonight with Ryan.
Ok thank you a lot for your help! It is working correctly now.
This is when a notification is clicked and a custom url is displayed. I'd like to add a dynamic querystring to the custom url as it is loaded. Is this possible?