Transaction Manager not showing storekit 2 transactions in Xcode - ios

I am trying to test in-app purchase localy using configuration.storekit file.
I'm able to do perform the fetch, buy, restore, etc on the simulator, but the same is not getting displayed on the Transaction Manager [(with Xcode selected) Debug->Storekit->Manage Transactions...]
Also, I am not able to fetch the products using product IDs in the testcases using StoreKitTest framework
I have use pod lib create to make a cocoapod of MyFramework which is having all the In-App purchase related code/logic. Have a target for testcases (MyFramework-Unit-Tests), have tried linking the StoreKit Configuration File with both the MyFramework and MyFramework-Unit-Tests targets, and without linking too
I have created a file IAPSubscriptions.storekit, and have tried specifying target to it - MyFramework, MyFramework-Unit-Tests
Has anyone faced these issues, and how shall I resolve these?
For reference:
Modularisation followed by me is wrt: https://github.com/kudoleh/iOS-Modular-Architecture
My podfile has:
def MyFramework_pod
pod 'MyFramework', :path => 'DevPods/MyFramework', :testspecs => ['Tests']
end
abstract_target 'MyFramework' do
project 'DevPods/MyFramework/Example/MyFramework.xcodeproj'
target 'MyFramework_Example' do
platform :ios, '15.0'
MyFramework_pod
end
end
My podspec has:
s.test_spec 'Tests' do |test_spec|
test_spec.source_files = 'MyFramework/Tests/**/*'
end

I resolved the issue by adding the StoreKit.framework as a dependency to the app project.

Related

Unable to build React Native project on iOS: No component found for view with name "ARTShape"

I receive the following error when I try building a React Native app on iOS:
No component found for view with name "ARTShape"
I don't have any such problems on Android. I've tried the solution here but it's not working: in Xcode, after making those changes and pressing CMD+B, I am receiving the following error under the category Lexical or Preprocessor Issue:
'React/UIView+React.h': file not found
Use POD linking ART library like this:
1) Add ART to pod file
pod 'React-ART', :path => '../node_modules/react-native/Libraries/ART'
2) run pod update to ios directory.

Firebase Class FIRAAppEnvironmentUtil is implemented in both when using Cocoapods

I'm trying to use Firebase inside a dynamic framework (Cocoa Touch Framework). I've added Firebase to the Podfile like so:
platform :ios, '9.0'
use_frameworks!
workspace 'Test.xcworkspace'
target 'Test' do
project 'Test.xcodeproj'
end
target 'TestFramework' do
project 'TestFramework/TestFramework.xcodeproj'
# Pods for TestFramework
pod 'Firebase/Database'
pod 'Firebase/Auth'
end
And I've set a target dependency in the build phase of my Test target. All according to: https://github.com/benasher44/CocoaPodsLibExample
However when I reference my TestFramework from my Test target during app startup I get this message (for all the Firebase classes) in the console:
objc[34978]: Class FIRAAppEnvironmentUtil is implemented in both
/Users/peterwarbo/Library/Developer/Xcode/DerivedData/Test-goxvmnklbfyswhdniydzbvzudcez/Build/Products/Debug-iphonesimulator/TestFramework.framework/TestFramework
(0x1085858c8) and
/Users/peterwarbo/Library/Developer/CoreSimulator/Devices/43080C45-C9E9-4237-A255-5029CC4D5797/data/Containers/Bundle/Application/FCFDC439-8564-40A8-9B34-935FE222193E/Test.app/Test
(0x104342938). One of the two will be used. Which one is undefined.
And the app crashes. I've read that this might have something to do with that Firebase is a static library. I need to solve this so I can use my use Firebase from my different targets. Specifically what I'm trying to achieve is to be able to do Firebase operations from a keyboard extension, so both my host app and my extension should be able to to perform Firebase operations.
I've been trying to solve this for more than a week now and I haven't come up with any working solutions :(
I'm using Xcode 8.2.1, Cocoapods 1.2.0

How to add Firebase to Today Extension iOS

I need to be able to use Firebase in my Today View Extension, however I cannot seem to import the Firebase module. I think it's because I need a new target in my cocoa pods file, but I'm not sure on how to do this.
Thanks.
You have to treat the today extension as its own separate app(somewhat)
in your firebase project dashboard, you need to hit the "Add another app" button.
select iOS and then enter the BUNDLE ID of your TODAY EXTENSION
Complete the wizard and download the generated GoogleService-Info.plist file
Add the plist file to your Today Extension's root folder
go to your xcode project, and manually add FirebaseCore.framework and FirebaseDatabase.framework to your Today Extension
finally inside your today today viewcontroller call FirebaseApp.configure()
import FirebaseDatabase
import FirebaseCore
override func viewDidLoad() {
super.viewDidLoad()
FirebaseApp.configure()
}
Or without adding an extra app at the Firebase console, just re-use your main project's GoogleService-Info.plist with a minor modification (see below). The Firebase app singleton would have to be configured either way in both apps on startup.
To synchronize an extension and the containing app see App Extension Programming Guide: Handling Common Scenarios or this reddit comment. This Stackoverflow thread specifically describes this scenario.
Steps:
Copy the containing app's GoogleService-Info.plist into your extension in Xcode
Drag the copied GoogleService-Info.plist into Xcode into your share extension and
Change the BUNDLE_ID to the name of your share extension's target
Add new target to your Podfile
Install dependencies (pod install)
Configure the Firebase application object in your extension
Step 1. Copy the containing app's GoogleService-Info.plist into your extension in Xcode
Step 2. Drag the copied GoogleService-Info.plist into Xcode into your share extension and
Step 3. Change the BUNDLE_ID to the name of your share extension's target
For us the main (i.e., containing app) is Access News and the share extension is Access-News-Uploader.
Step 4. Add new target to your Podfile
# ...
target 'name-of-your-extension' do
use_frameworks!
pod 'Firebase/Core'
pod 'Firebase/Auth'
# etc.
end
Entire Podfile of our project.
Step 5. Install dependencies (pod install)
Step 6. Configure the Firebase application object in your extension
/* 1. Import Firebase */
/**********************/
import Firebase
/**********************/
class WhereverInYourExtension: WhateverController {
// ...
override func viewDidLoad() {
super.viewDidLoad()
/* 2. Configure Firebase */
/*************************/
if FirebaseApp.app() == nil {
FirebaseApp.configure()
}
/*************************/
// ...
}
Pod issue fixes
1) Still unable to import Firebase!
Make sure that pods are installed for all targets in your project. To achieve this use inherit! or abstract_target in your Podfile.
The simplest example using abstract_target from the official documentation:
abstract_target 'Networking' do
pod 'AlamoFire'
target 'Networking App 1'
target 'Networking App 2'
end
For inherit!, see this SO question and answer.
2) How do I achieve this on my existing app without messing things up?
Remove Podfile, Podfile.lock and YourProject.xcworkspace
Issue pod init and it will list your existing targets one by one.
Edit the Podfile by either grouping under abstract_target or using inherit!
Issue pod install
A new YourProject.xcworkspace file will be generated, and if you open the your project using this, under General > Linked Frameworks and Libraries it will show that Firebase is added and can be imported from project files.
(See this SO thread for a concrete example where this clean-up method needed to be used.)
3) firebase 'sharedApplication' is unavailable: not available on iOS (App Extension) - Use view controller based solutions where appropriate instead.
This is what worked for me:
wiped everything clean by cloning our project repo fresh from Github,
deleted
~/Library/Developer/Xcode/DerivedData
./Pods/
Podfile
Podfile.lock
Issue pod init on the console
Recreate Podfile (basically copy-paste)
Issue pod update on the console
(Probably won't work next time.)
To my knowledge widgets are not allowed to use certain api's such as firebase. Widgets are supposed to show data provided by the main application via UserDefaults e.g.
TodayViewExtensions (or widgets) may only be very light codewise.

Integrating Parse in App extension

I’m trying to implement parse functionality in a app extension. The main app uses Parse to push and retrieve data. The problem is I can't install the parse SDK to my app extension. Is this even possible? I've been on google for about three hours and I’m starting to think not. I've tried to init another pod file and I’ve tried the the abstract_target function. No matter what I do, I can't seem to import it. Has anyone achieved this before? Im using swift 2.0 if that helps.
If there is another way to carry out the following, please let me know:
(This happens in the share popup view)
1.Grab user input text
2.Push it to the parse backend
in order to use Parse ios SDK in your app extension you are require to do the following:
enable local data store (local data store is where your data is being saved locally on your device)
Enable app groups and keychain sharing in both of your targets (your main app and your extension) this allows you to share the data and the session between your app and your extension.
When i did it. I follow this guide which explain how to integrate apple watch and app extension with parse IOS SDK.
If you are using CocoaPods in your project please make sure that you load the Parse pod also to your extension..
so let's assume that the only pod that you have in your Podfile is pod 'Parse' you Podfile should look like the following
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
use_frameworks!
def my_pods
pod 'Parse'
end
# Change the MainAppTargetName to your main app target
target 'MainAppTargetName' do
my_pods
end
# change MyExtensionTargetName to your extension target name
target 'MyExtensionTargetName' do
my_pods
end

App Invite configuration failed Firebase iOS cocoapods

I got a build error with this in it while trying out the new version of firebase
*** Terminating app due to uncaught exception 'com.firebase.appinvite', reason: 'App Invite configuration failed.'
Click on your project
Navigate to Info tab
Scroll down you will see the URL Types
Click the + button and add your bundleID to URL Schemes
Click the + button again and add your REVERSED_CLIENT_ID to URL Schemes. This can be found in your GoogleService-Info.plist
Finally your URL types should look something like this
The Invites pod does require setting up a couple of custom URL schemes, which is easy to skip over. You can do this in you Info.plist, or in the General tab of the target in Xcode. The two custom URL schemes are:
Your bundle ID. e.g. "com.foo.bar"
Your Google Sign In client ID with the components reversed. e.g. "com.googleusercontent.apps.12345678-xxxxxxxxx".
The second one is trickier! In the GoogleService-Info.plist you downloaded there should be a key REVERSED_CLIENT_ID you can copy the value of. For what its worth, I find that the first build after I edit the custom URL types doesn't seem to register it properly, so if it doesn't work right away, just try again.
My podfile had the following. I just had to uncomment the Firebase/Invites pod. There seems to be a problem with it for now.
pod 'Firebase'
pod 'Firebase/AdMob'
pod 'Firebase/Analytics'
pod 'Firebase/AppIndexing'
pod 'Firebase/Auth'
pod 'Firebase/Crash'
pod 'Firebase/Database'
pod 'Firebase/DynamicLinks'
#pod 'Firebase/Invites' this caused an exception!!
pod 'Firebase/Messaging'
pod 'Firebase/RemoteConfig'
pod 'Firebase/Storage'
Firebase Invites works over Firebase Dynamic Links so, by following the Dynamic Links guide, you need to setup 2 things in your project:
Add Url type
At Target settings, info tab, add the new url. Set the schema your bundle ID. If you use other schema you have to set it on Dynamic Links page at Firebase console.
Associate the Firebase Dynamic link domain in your app.
Go to Firebase console and copy from Dynamic links section the
Firebase-generated Dynamic Link Domain of your app.
Go to target settings, capability tab, and enable Associated Domains.
Add the Firebase-generated Dynamic Link Domain you just copied.
This should fix the configuration error as it did in my case. Anyway i advise to read the full guide.

Resources