ReplayKit's RPSystemBroadcastPickerView not showing preferredExtension - ios

I am using RPSystemBroadcastPickerView to show a picker view, from which a user can select a broadcast service to record the screen. Based on documentation, preferredExtension should allow me to set which broadcast extension should the picker show.
The code is super simple:
let broadcastPickerView = RPSystemBroadcastPickerView(frame: CGRect(x: 0, y: 0, width: 51, height: 51))
view.addSubview(broadcastPickerView)
broadcastPickerView.preferredExtension = "com.milan.nosal.broadcast-extension"
broadcastPickerView.backgroundColor = .clear
broadcastPickerView.showsMicrophoneButton = false
where "com.milan.nosal.broadcast-extension" is the bundle identifier of the extension I want the picker to offer (I checked its correctness multiple times).
However, when the control is tapped, at first the pop up shows empty selection:
After you close it, and tap the control again, it shows the correct extension. This only happens when the app is installed (or reinstalled), after it shows, then it shows always.
Is this the iOS 12 beta bug, or am I doing something incorrectly? Can I "preregister" the extension to work around this?
EDIT:
After publishing the app, we encountered the same problem with our users, but this time not even tapping the control multiple times helps - the picker is always empty! It seems that the extension is installed correctly, because it can be launched from control center.
Running on official release now.

Note that this is for ANY iOS Version:
I just burned a full day on this. When you add the BroadCast extension, Apple will automatically add the highest possible iOS Version for the deployment target. You need to make sure this isn't higher than your physical device's iOS Version. You won't get any build errors, they just won't show your app in the broadcast extension list.

I think it is the apple's bug, but it was fixed in iOS 12.2 after I tested it.

I have the same issue, looks like Xcode has some issues how to install broadcastExtension with you app. For me, It is related only for Debug mode. To see correct UI, try to enable broadcasting once in old way (control center -> deep touch -> start broadcast), after that in your BroadcastPickerView you will see correct UI (you are pushing iOS to update information about the extension). Cannot reproduce in release mode.

You can find your exactly preferedExtension here:
When you add pickerView.preferredExtension exactly the Bundle Identifier, your app will be showed on the Recording App List. Hope this helps!

If I do not set ".preferredExtension", I see all extensions on the list.
I tested on iOS12 GM.

You add Broadcast Upload Extension into your project and get that Extension Bundle Identifier.
How to create Broadcast Upload Extension into your app?
Go to xcode - File - New - Target - Broadcast Upload Extension
Then Add this line into your app. when you created RPSystemBroadcastPickerView object.
broadCastPicker?.preferredExtension = "com.vikrant.YourApp.Extension"

Related

Why does iPhone 13 running iOS 16.1.1 (changed from 15.5) change my app's behavior when auto copy/pasting?

I wrote an app which auto-pastes (pre)copied text into its interface.
When I ran that app under iOS 15.5 it displayed a toast message that the other app had pasted the text over.
It looked like the following:
Red Highlight is the toast message stating that this app pasted in text from the other app
Green Highlight is the text (789) that was pasted into this app in a scrollable UITextView
Running Same App Under iOS 16.1.1
I updated my phone to iOS 16.1.1 and now the app does something completely different.
Now it displays a message asking if I want to allow the paste.
It displays this every time copy / paste functionality is executed in the app.
Swift Code Snippet For Copy / Paste
Here's the very simple Swift code that handles this copying from clipboard in my app:
let noClipboard = "No Clipboard Data"
dataToSend = "\((UIPasteboard.general.string ?? noClipboard))"
if (dataToSend == noClipboard){
outputMessages.text += "No data to send. Try again!\n"
return
}
outputMessages.text += "\(dataToSend)\n"
Main Questions
Is there any way to make this only show up one time?
Is there any way to suppress this pop-up dialog?
iOS Emulator Running 16.x
I cannot presently reproduce this effect within XCode because all the emulators still run 15.5
When will an emulator that runs iOS 16.1.1 be available?

UnityAds in iOS using wrong game id, and not working

I am using UnityAds in my mobile game, to show a banner and a rewarded video.
In the editor and in Andorid works fine.
However for iOS it doesn't work, i took the logs and i noticed that for iOS is using my android gameid, this i have no idea where it comes from, i searched every file in my project, i never reference the android gameid, just the iOS one.
So it is clearing taking the id not from my initialization but from some sort of cache, anybody has an idea where is taking the gameid from? thanks
Btw
I am using Advertisement package from package manager.
You can open manually Project Folder\ProjectSettings\UnityConnectSettings.asset in text or code editor, then find
UnityAdsSettings:
m_Enabled: 0
m_InitializeOnStartup: 1
m_TestMode: 0
m_IosGameId: <---- THIS ONE
m_AndroidGameId:
m_GameIds: {}
m_GameId:
and edit it

Firebase iOS Debug Console not logging anything

I have setup firebase in both the console and in the app. Everything configures correctly, and events appear to be logging in the app.
Output to console:
<FIRAnalytics/DEBUG> Logging event: origin, name, params: app,
log_something, {
"_o" = app;
"full_text" = khbsdpibdsjl;
name = lwkjbgskljsavdkjl;
}
I have the debug flag enabled: -FIRDebugEnabled.
Yet in the debugging events console there is NOTHING. I see no devices available, no events being logged, absolutely 0 indication of anything connected. I must be missing something?
edit: I have been following this for setting up Debugging Events. https://firebase.google.com/docs/analytics/debugview#enabling_debug_mode
I am seeing events in the StreamView, but nothing in the debug view even though I have debug mode enabled.
Try this , This is work for me ,
Follow below steps ,
1.In Xcode, select Product → Scheme → EditScheme.
2.Select Run from left Menu and Select Arguments tab
In the Arguments Passed on + option
add -FIRDebugEnabled
For detail debug view follow steps DebugView track Firebase doc
To send an event in Xcode project follow code below,
Objective C
[FIRAnalytics logEventWithName:#"share_image"
parameters:#{#"name": name, #"full_text": text}];
Swift
Analytics.logEvent("share_image", parameters: ["name": name, "full_text": text])
For events log follow detail steps Log events in Application Firebase doc
Hope this will help someone.
Make sure to remove the OS_ACTIVITY_MODE:disable from the Environment Variables in your project scheme if you added it at some point.
Make sure to add ONE DASH before -FIRDebugEnabled
I wasted a whole day making silly mistake having missed that DASH
Hope that doesn't happen to others!
Now it doesn't matter much but still for the people who are getting errors on this issue. Debug mode of firebase analytics does not work sometimes due to issue in GoogleServices-Info.plist file
Simply makes these 2 changes.
Set IS_ANALYTICS_ENABLED to YES
Set FIREBASE_ANALYTICS_COLLECTION_DEACTIVATE to NO
I also have the same problems.
1 check your Cocopods' s Firebase version.
use pod update Firebase
List item
make sure that is the latest
2 open debug mode
In the Arguments Passed On Launch part
add - FIRDebugEnabled.
I made it possible by writing the following:
func application(_ application: UIApplication, didFinishLaunchingWithOptions, ...) {
// some other initialization
FirebaseApp.configure()
Firebase.Analytics.setAnalyticsCollectionEnabled(true)
}
Alternatively you can do that inside your AppDelegate:
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {
var newArguments = ProcessInfo.processInfo.arguments
newArguments.append("-FIRDebugEnabled")
ProcessInfo.processInfo.setValue(newArguments, forKey: "arguments")
}
---EXTRA---
And just some thoughts:
Regarding
Firebase.Analytics.setAnalyticsCollectionEnabled(true)
If we inspect the method:
So it's kind of POINTLESS...
Check if you have an ad blocker enabled while visiting the Firebase website.
I had uBlock origin enabled and it would block every page (Dashboard, Events, StreamView, DebugView...) and they'd all be blank.
Everything worked as expected as soon as I whitelisted it.
I recently had an issue where the Xcode console said everything was fine, and all was being logged and sent, and I had the "-FIRDebugEnabled" and I tried all other suggestions in this thread, but nothing worked.
Nothing was being sent to Firebase's DebugView.
Looking through my git-history, I determined the issue occurred due to a pod update, and the solution to my issue was another pod update.
I don't know which pod had failed, but I suspect either Moya, Alamofire or FirebaseAnalytics... after this, I'm strongly considering locking my pod-versions.
I had the same configuration as jaywant-khedkar, but no events or devices were showing up in the Firebase Debug View.
Found out that my pi-hole on my network was eating all the events.
So if if you have any kind of ad blocker on your network, disable it and try again.
Happy debugging!
If you've done everything that the Firebase documentation states, then it could be that you have the wrong "Debug Device" selected in Firebase Analytics' "Debug View". After changing the debug device in the top left, all my analytics events from before were displayed! So it wasn't that my events weren't being sent to Firebase, I was just seeing the wrong view. Image attached.
Had this issue a few days ago, after trying every solution I found on the internet and none of them working, these are the steps I used to finally enabled DebugView to find my device:
Close the app on the device you’re working on
Go to the Firebase console and sign out of your account
Sign back in again, go to the console and select the project you’re working on.
Again, not sure if this made a difference however do NOT click on DebugView item under the “Project shortcuts” list. Instead, click on the “Analytics” drop-down and select DebugView from there.
It may be possible that this process updates the data stream used in the DebugView page - after following these steps I noticed events which had been missed initially were now showing up - almost as if the event was sent/received properly however the DebugView wasn’t showing the correct data stream.
Bonus tip:
Had issues with this again today, and after signing out/in to Firebase the DebugView still wasn't finding my device. What fixed it was, on my device, move the app into the background i.e. swipe up from the bottom to go to the home screen...
When you re-open the app into the foreground, the DebugView should now start displaying events. I imagine this works because the action of moving the app into the background I believe triggers any saved events on the device to be sent to Firebase, essentially flushing the queue.

Debug Notification Extensions

I'm building a set of Notification Extensions (Service/Content).
I'm unable to connect to Xcode debugger or even log out to the device log or console.
Is there any way to see any kind of output?
Change the target to run the extension
then select run and choose your app from the 'Choose an app to run:' window.
I have tried as per brendan's Answer but is not working for me at all!
I am getting below error in console
Program ended with exit code: 0
Then after searching on google i have checked this answer. however this also not worked for me for while!
Then i have tried same steps again as given in answer, After stopping my current running app. then follow same steps.For clarity i am writing this steps as below:
After running the app that contains the extension,
1) Set your breakpoint in the extension
2) Select Debug / Attach to Process by PID or name
3) Enter the name of the extension target
4) Trigger the push notification
Before step 2 make sure to stop your current running app.
This worked for me to stop at breakpoints in the extension and see the extension log:
Choose the notification extension scheme, not the main app scheme
Run the app and select the main app from the list Choose an app to run
Stop the app in Xcode and terminate it manually on the device; not terminating it manually results in Message from debugger: Terminated due to signal 9 after step 6.
[Update: Terminating the app manually on the device doesn't seem to be necessary, try either way if it doesn't work.]
Select Menu Debug > Attach to Process by PID or Name
Enter the correct extension name, not the main app name
Send the push notification
Notification service extension (NSE) is not actually a part of your app but an extension that said it has a different process id (PID) from your app. You can have XCode listen to every process on your phone by going to the “Debug” tab, scroll down to “Attach to Process” and look to see if your NSE is listed under “Likely Targets”. If it's not there than try to sand another push notification to your device and attach to it when it appears.
Now in debug navigator you can see the NES process and you can successfully debug it.
In my case all methods above had some mistakes. Main point, that you need to send push one time, then connect through debugger, then send push to debug. So, full list:
Launch app (not extension).
Stop app from XCode.
Send one push.
Connect via "Attach to Process by PID or Name..." to your extension process.
Send another push.
If you have tried all the above solutions and still scratching your head and wondering why break point point is not being called. Then try checking the deployment target of your extension it should be less or equal to your device OS.
For me, the deployment target was higher than the device OS.
In my case (Xcode 11.1) debug starts after this steps:
run notification extension target with main app
switch app to background
lock the phone !
send push to device
I followed solutions mentioned here but nothing helped. I found out that problem is when payload of notification does not contain flag to enable content to be mutated. Notification without this flag are not handled by NotificationExtension at all. After I added "mutable-content": 1 to the payload and followed answers here I was able to alter content of push notification and to debug code in NotificationExtension.
{
"aps": {
"mutable-content": 1,
"alert": {
"title": "Push Title",
"body": "Push payload body"
}
},
"data": "what ever you need to be in userInfo"
}
Not sure if this will be helpful, but we have multiple builds of the same app (alpha, beta, etc). Kept getting a "don't have permissions to attach" error when trying to debug. Opening up the processes list, I noticed that there were 2 processes named notification-extension so xcode must have been defaulting to the one of the other build. By manually selecting the right one, or deleting the other builds from my phone things started working again.
The only way that worked for me was to see logs. I use xcode 10.1. The logs were available from Window -> Devices and Simulators -> Choose your device -> click on 'Open Console'.
This way i could see logs from extensions as well.

Cycript script to run app in background

I have a cycript backboardd script that works great on iOS 7 for modifying an app to continue running in the background.
app = [BKProcess processForPid:$PID];
alive = [[BKProcessAssertion alloc] initWithReason:7 identifier:"AppKeepAlive"];
[alive setFlags:0xF];
[sc addAssertion:alive];
This is all that's needed. However on iOS 8 this does't work as BKProcess is now BKSProcess and BKProcessAssertion is now BKSProcessAssertion and they have different methods.
There doesn't seem to be a way to attach the assertion to the app like on iOS 7.
Can some please help me get this working under iOS 8.
There is, however when I used this I simply used the initializer with the required PID.
- (id)initWithPID:flags:reason:name:withHandler:
Check out the BKSProcessAssertion header for reference.
If you want to see an implementation for reference, check out MessageBox (now deprecated, but for reference):

Resources