I implemented AdMob into my app and linked it with Firebase which I am also using for database.
Before that I tried AdMob on new, sample project to see how it works. Its pretty simple so I put it in my app project.
AppDelegate
GADMobileAds.configure(withApplicationID: "myAppID")
Problem is that I made everything as necessary but my ad is not showing up as it did in sample project. I ran app on my device and added bannerView and configuration for it
let request = GADRequest()
request.testDevices = [kGADSimulatorID, "myDeviceID"]
bannerView.adUnitID = "myID"
bannerView.rootViewController = self
bannerView.load(request)
Problem here it because if I enter Firebase testing purpose adUnitID to test it, it works but with mine it doesn't.
Any ideas?
Related
I'm trying to add checkin functionality on my app. I got the place Id from admin panel and If user wants to checkin their they can do that through my app using the code below, but for some reason this code is not working only posting the link without taking the location, even this code can post quote as well but no location.
PS: The Facebook app is in development mode and the place id is valid as the same place id is working on android.
let content : ShareLinkContent = ShareLinkContent()
content.contentURL = URL(string: "https://www.google.com")
content.placeID = "493869400814446"
let dialog = ShareDialog(
viewController: self,
content: content,
delegate: nil
)
dialog.mode = .automatic
dialog.show()
In app purchases work fine for my iOS side of things. The data from StoreKit is populated as it should. The same code doesn't work on the Mac Catalyst version of the project. I have even created a listing for my Mac app on App Store connect with different bundle identifiers for the in app purchases. I have a print function that returns what product StoreKit found, it works well on iOS, but results with nothing when using Mac Catalyst.
Here is what I have done:
Make sure that In App purchases has been added in the capabilities section.
Make sure the Store Kit framework has been imported.
Make sure the bundle identifiers are correct.
Make sure all agreements are filled out.
I am signed out of the Mac App Store.
Code that works on iOS but not on MacOS:
override func viewDidLoad() {
SKPaymentQueue.default().add(self)
let productIds: Set<String> = ["..."]
var request = SKProductsRequest(productIdentifiers: productIds)
request.delegate = self
request.start()
}
func productsRequest(_ request: SKProductsRequest, didReceive response: SKProductsResponse) {
print("Loaded")
for product in response.products {
print("What came: \(product.productIdentifier) \(product.localizedTitle) \(product.price.floatValue)")}
The iOS app will return with the Product Identifier, Title and Price. The Mac app will return with nothing at all.
I found the problem. I had not created a strong reference to my product request.
This line of code fixed my issue:
var request: SKProductsRequest!
This is my code:
let request = GADRequest()
request.testDevices = [kGADSimulatorID, "XXXX2F32d69CCA859FFB559D0FEA3CF6483D08A6"]
adView.load(request)
Where XXXX is my UDID of my iPhone. Why do I get real ads and not test ads on my iPhone? Test ads on the simulator works. Thank you. Tried the UDID in uppercase and lowercase.
This fixed it for me!
Product -> Scheme -> Arguments -> Environment Variables if there is a key: OS_ACTIVITY_MODE, disable/remove it.
As mentioned in admob guide
while running the app in device you get the below log
<Google> To get test ads on this device, call: request.testDevices = #[
#"2077ef9a63d2b398840261c8221a0c9b" ];
use that id instead of UDID.
As I understood your, I concate your UDID and ID in the log. This is wrong.
You this - pure ID :
let request = GADRequest()
request.testDevices = [kGADSimulatorID, "2F32d69CCA859FFB559D0FEA3CF6483D08A6"]
adView.load(request)
https://firebase.google.com/docs/admob/ios/targeting
I'm looking at adding a rewarded video ad to my app that is written entirely in swift. I believe the setup of the web side of things is correct because when I downloaded the Objective C example app and put in my ad id the video showed up correctly. However, when running the same setup in Swift I get returned
Error Domain=com.google.ads Code=1 "Request Error: No ad to show." UserInfo={NSLocalizedDescription=Request Error: No ad to show., NSLocalizedFailureReason=Request Error: No ad to show.}
I've only had ONE time where it actually returned a video. I'm using Chartboost.
Another interesting point is that if I used chart boost directly it seemed to work.
Also, banners work perfectly fine through AdMob in the same app.
Request I Make
let request = GADRequest()
request.testDevices = [ kGADSimulatorID ]
GADRewardBasedVideoAd.sharedInstance().loadRequest(request, withAdUnitID: "AdUnitID")
So I have tried to add Aviary's IAP purchases and have had little luck getting them to show up in my application. I have not made sure that following has happening
My Provisioning Profile being used to build the application has IAP's turned on
I have uploaded all of Aviary's IAP's to itunes connect
I have added the required code for IAP's in my app delegate:
[[AFPhotoEditorController inAppPurchaseManager] startObservingTransactions];
[AFPhotoEditorCustomization enableInAppPurchases:#YES];
Before I start my photo editor session I add the following code
AFPhotoEditorController* photoEditor = [[AFPhotoEditorController alloc] initWithImage:imgToBeEdited];
[AFPhotoEditorCustomization enableInAppPurchases:#YES];
mPhotoEditorSession = [photoEditor session];
editorController = photoEditor;
[photoEditor setDelegate:self];
They are not showing up at all and I am uncertain of what Aviary is taking care of and what I should be taking care of
I think it might have to do with this line in the documentation:
Add the following lines to your app delegate's -applicationFinishedLaunchingWithOptions: method before invoking any StoreKit framework methods:
[[AFPhotoEditorController inAppPurchaseManager] startObservingTransactions];
This line adds the in-app purchase manager singleton as an observer of the StoreKit payment queue returned by [SKPaymentQueue defaultQueue], and sets a flag enabling in-app purchase code throughout the SDK.
Has anyone added this to their application and let me know what Storekit methods I need to invoke? Any sample code is helpful.
thanks in advance!