Snapchat SDK getting stuck on completion page Swift/Xcode - ios

so I'm working on an app right now where I need to add snapchat login. To do this, I am using their LoginKit SnapSDK. I implemented it as instructed, but when a user tries to log in, they don't go to the snapchat app but rather it opens a safari popup. This wouldn't be an issue if it worked, but it doesn't. The user can put in their credentials, but on the last page they are prompted with a "continue" button that doesn't do anything. Because it does nothing, the user is never logged in and the popup doesn't close. Below I have attached my code (very simple), an image of my Info.plist, and an image of my Frameworks.
Code:
SCSDKLoginClient.login(from: self) { success, error in
if let error = error {
// An error occurred during the login process
print(error.localizedDescription)
} else {
self.dismiss(animated: true)
self.getUserInfo()
}
}

You made a mistake in your info.plist
for item 3 in LSApplicationQueriesSchema which is rocket should be part of URLScheme. Remove that rocket and put it in URLSchemes
You can just copy this code
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>CFBundleURLSchemes</key>
<array>
<string>rocket</string>
</array>
</dict>
</array>
As for frameworks make sure it looks like this

Related

Why do I get error 34018 for keychain when side-loading an app?

I have tried to side-load YouTube, but the issue is in login. I get the web login page for Google, and login fine but afterwards I get the message inside app that I am using YouTube in signed-out mode. If I press the account settings page, I get the "Sign in" button.
The console keeps displaying this message:
YouTube(Module_Framework)[11300] <Notice>: Keychain Error: Unable to add new item: -34018
I am not making any modifications to app, and simply got a decrypted IPA (v13.32.7) to play with.
I have the following in my entitlements:
<key>keychain-access-groups</key>
<array>
<string>6Gxxxxxxxx.com.xxxxx.ULYouTube</string>
</array>
<key>get-task-allow</key>
<true/>
<key>com.apple.security.application-groups</key>
<array>
</array>
<key>com.apple.developer.default-data-protection</key>
<string>NSFileProtectionComplete</string>
Any help would be appreciated.

Custom URL works in simulator but not on a device

I went through and followed this tutorial to use Custom URL. Everything works as expected on Simulator, so when I use safari and hit myApp:// a dialog pops up asking if I wish to open the app. SO far so good. However, when I installed the app on a device and hit the same thing in safari I get an error saying Cannot open page. Safari cannot open the page because the address is invalid. I tried this enough times, so it's definitely not a typing error. Any help is greatly appretiated.
.plist:
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLName</key>
<string>com.xyz.myApp</string>
<key>CFBundleURLSchemes</key>
<array>
<string>iOSMyApp</string>
</array>
</dict>
</array>
I copied my bundle identifier for CFBundleURLName.
ANSWER: So just before I was about to bang my head on the desk what I found that it's working when I open a new tab in Safari and then hit the app URL. And I have no idea why this happens. Also if you cancel it and then hit the app URL in the same tab again, it will give you an error I mentioned in the question. So the trick is to hit the app URL in a fresh tab everytime.
This setup is working for me. One thing I have to do is close the current tab of safari and open new one and type
iOSMyApp://

Code=3072 "The operation was cancelled" when setting alternate app icon

I am trying to set an alternate app icon named MyIcon in my iOS app. I have a MyIcon.png image in my project bundle (not in my Assets folder) and it is declared in my Info.plist like so:
<key>CFBundleIcons</key>
<dict>
<key>CFBundleAlternateIcons</key>
<dict>
<key>MyIcon</key>
<dict>
<key>CFBundleIconFiles</key>
<array>
<string>MyIcon</string>
</array>
<key>UIPrerenderedIcon</key>
<false/>
</dict>
</dict>
</dict>
In my code, I try to change the app icon:
UIApplication.shared.setAlternateIconName("MyIcon")
However, the icon doesn't change and I am instead given this error in the console:
Error Domain=NSCocoaErrorDomain Code=3072 "The operation was cancelled."
How can I fix this issue?
I was getting this error because of two reasons,
First(and highly not because of), I didn't do "Add Files to 'ProjectNameFoo'" by adding png file to project. Otherwise it didn't work. After that it started to see icon.
Secondly(and highly possible reason), I was getting this error because I was trying to change the icon in viewDidLoad. When I try with a delay like the code below it was working whatever second I gave.
override func viewDidLoad() {
super.viewDidLoad()
DispatchQueue.main.asyncAfter(deadline: .now() + 1) {
UIApplication.shared.setAlternateIconName("MyIcon")
}
}
I was stuck with this error for quite a while and tried all sorts of things but couldn't work out what I was doing wrong. I was changing the icon from AppDelegate.application(didFinishLaunchingWithOptions:). Delaying the call with a timer as suggested above did solve it.
It is worth noting that this problem is due to UIKit trying to show a UIAlertController with the message
You have changed the icon for $(PRODUCT_NAME)
and that didn't seem to work at that point. You need to wait until a root view controller is loaded.
This is because this API is not meant to for the developer to update the icon arbitrarily, but for the user to deliverability choose one.

Uber native login flagging error

I am currently running the example codes provided by Uber SDK (Objective C version).
I encounter a problem when I clicked on the Native Login and Ride Request Widget Button provided by the Objective C example.
After setting up the app in Uber and also copied the Client ID to the info.plist, I counter the error below:
When I click at the Ride Request Widget Button, the app will load a new view with the "Ride there with Uber" button. After clicking the "Ride there with Uber" button, the example app will flag a UIAlert with a message of "There seems to be a problem connecting to Uber. Please go back to AppName and try again". What could be the problem?
Btw, I fill in the redirect URL as "myapp://oauth/callback" on both the dashboard and the app info.plist.
Anything I miss out during the setup of this example?
Thanks.
Make sure the URL Scheme in Targets > Info is set to something like sampleApp, and not sampleApp://uberSSO. This solved my problem.
For reference, here is the snippet from the Info.plist:
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>CFBundleURLName</key>
<string>MySampleAppName</string>
<key>CFBundleURLSchemes</key>
<array>
<string>sampleApp</string>
</array>
</dict>
</array>

CFBundleUrlTypes visible in the Info.plist but not in the XCode view of it

I am debugging my integration of Facebook iOS SDK 4.10 on iOS 9 (it works but the login is always done through a webview and doesn't open the Facebook app).
I have a problem with CFBundleUrlTypes, I have added it (many times) through XCode: Project > Info > Url Types... In fact it is persisted, because I can: cat Info.plist|grep -C 10 -i urltypes and get:
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLName</key>
<string></string>
<key>CFBundleURLSchemes</key>
<array>
<string>fb$(FACEBOOK_APP_ID)</string>
</array>
</dict>
</array>
But I relaunch XCode it's not visible anymore in the project info.
Starting from iOS9, Facebook uses the Safari View Controller for Login rather than a fast app switch. The SDK basically tries to determine the best possible experience for the user so this is probably why you are always routed to the web based login.
It is also partly to get around the "APPNAME wants to open OTHERAPP" you will see in iOS9.
The documentation slightly touches on this here https://developers.facebook.com/docs/ios/ios9#faq

Resources