RPScreenRecorder stopRecording block not getting called - ios

I have searched enough but failed to get a solution.
I am using ReplayKit to record the screen of my app. I have started recording the screen by calling
let sharedRecorder = RPScreenRecorder.shared()
sharedRecorder.startRecording() { error in
if let error = error {
self.showScreenRecordingAlert(message: error.localizedDescription)
}
}
When I am pressing the stopRecord button I am calling
let sharedRecorder = RPScreenRecorder.shared()
sharedRecorder.stopRecording { previewViewController, error in
if let error = error {
self.showScreenRecordingAlert(message : error.localizedDescription)
return
}
}
But the issue that I am facing is, the program control does not enter inside the stopRecording block.
When I am doing po sharedRecorder.isRecording, it always returns false.
I have done everything I know but failed to get a solution.

If you having this above issue with your code i have found the solution for this.
let sharedRecorder = RPScreenRecorder.shared()
sharedRecorder.stopRecording { previewViewController, error in
if let error = error {
self.showScreenRecordingAlert(message : error.localizedDescription)
return
}}
Above Block will not call if you running your app on simulator so please use real device to test then above method will call definitely.
Thank you.

Just had this issue running XCode 9.4.1 and building onto iOS 11.4.0. Upgrading the phone to iOS 11.4.1 fixed the bug. I'm not sure if the difference in XCode versions is the root cause or if 11.4.0 was just broken.

Related

Callback issue with getSteam iOS sdk

I think something wrong with the iOS SDK of getStream. I m not getting any callback on following , unfollowing and checking if user is following someone.For all these three case callback is not coming.
Even in the sample app given by stream is not working for these case.
Below is the code from ProfileViewController from sample app.
Rest of the sample app working fine.
Url of the sample is : https://github.com/GetStream/swift-activity-feed
User.current?.isFollow(toTarget: flatFeedPresenter.flatFeed.feedId) { [weak self] in
button.isEnabled = true
if let error = $2 {
self?.showErrorAlert(error)
} else {
button.isSelected = $0
}
}
It was a bug, inside isFollow the user flat feed is deallocating after the request. Please check the new version v.1.0.11.

iOS UITests can't do basics actions after Swift 3 update

In my iOS i'm implementing UITests using XCUITest. It worked great since I had Swift 2.3, but after updating the app to Swift 3 basic actions like tap() don't work anymore.
Just a simple code that doesn't work anymore:
XCUIApplication().buttons["orgMenu"].tap()
throws
Assertion Failure: <unknown>:0: UI Testing Failure - Failure getting snapshot Error Domain=XCTestManagerErrorDomain Code=9 "Error -25204 getting snapshot for element <AXUIElement 0x7f8297d15a50> {pid=32375}" UserInfo={NSLocalizedDescription=Error -25204 getting snapshot for element <AXUIElement 0x7f8297d15a50> {pid=32375}}
The name of the button is correct: if I record the test and tap the button the line above is exactly what I get.
The button is in the view since I'm waiting for the existence of it (tried both manually, through a breakpoint, and programmatically with this:
let exists = NSPredicate(format: "exists == 1")
expectation(for: exists, evaluatedWith: XCUIApplication().buttons["orgMenu"], handler: nil
waitForExpectations(timeout: time, handler: nil)
)
And anyway, it worked before Swift 3.
Any idea? Thanks in advance!
I'll just answer to my own question, since I found a workaround.
Since Swift3, for some reason, UI tests are not able to manage views with a loadMore pattern. If I have in my view a TableView and somewhere in the code a manage the loadMore pattern manually, and in a test I tap a button, the loadMore is called in a sort of infinite loop, and that overheads the app's resources, making the test fail.
Workaround: just deactivate any loadMore if a UI Test is running.
In the tests' setup:
override func setUp() {
super.setUp()
let app = XCUIApplication()
continueAfterFailure = false
app.launchEnvironment = ["isUITest":"YES"]
app.launch()
}
In the view with the loadData:
-(void)loadMore
{
if ([Utils isRunningUITest]) {
return;
}
// My actual function.
}
and my Utils
+(BOOL)isRunningUITest {
NSDictionary *environment = [[NSProcessInfo processInfo] environment];
return environment[#"isUITest"];
}
Sorry for Swift and Objective-C mix, hope this is helpful to someone.
You can try and do something like:
let app = XCUIApplication()
XCTAssert(app.buttons["orgMenu"].waitForExistence(timeout: 10))
app.buttons["orgMenu"].tap()

Failed to get images from camera DJI OSMO

I'm working with DJI sdk to get the photographs taken with the camera osmo. The problem I have is that when I show a picture on the screen gives me the following error:
"ERROR: fetchThumbnailWithCompletion: ErrorDomain DJISDKErrorDomainCode = -1004 =" System is busy, Please retry later (Code: -1004). ""
So it is written in the sdk:
#IBAction func onShowThumbnailButtonClicked(sender: AnyObject) {
self.showThumbnailButton.enabled = false
if self.imageMedia?.thumbnail == nil {
// fetch thumbnail is not invoked yet
self.imageMedia?.fetchThumbnailWithCompletion({[weak self](error: NSError?) -> Void in
if error != nil {
self?.showAlertResult("ERROR: fetchThumbnailWithCompletion:\(error!.description)")
}
else {
self?.showPhotoWithImage(self!.imageMedia!.thumbnail!)
}
self?.showThumbnailButton.enabled = true
})
}
}
But I need to show 6 images, therefore I make 6 times (6 times using a do) what is inside the IBAction. Then at that time the error occurs, because if I do it only once that error does not happen.
In addition, selecting ok error that appears like still works for other images but the idea is that no such error appears.
Any idea how to fix it?
Please ensure you have switched the camera to download mode (https://developer.dji.com/iframe/mobile-sdk-doc/ios/Classes/DJICamera.html). If you have already done that, then add delay between photo shooting and download.

Updating to Xcode 7 Beta 5 & Swift 2 produced multiple errors

I updated Xcode to the new Xcode 7 beta 5. In doing so, it converted to Swift 2, but then created even more errors. Right now, I am completely stuck, and don't know what to do, because although all my errors are gone, my app will not work correctly.
My problem is this:
if(self.myOutput3 as? NSObject == true) {
print("IT IS TRUE")
PFUser.logInWithUsernameInBackground(self.myOutput1 as! String, password: "xxx") { (user: PFUser?, error: NSError?) -> Void in
if error == nil {
print("It Worked!")
// self.presentViewController(destViewController, animated: true, completion: nil)
let instillation = PFInstallation.currentInstallation()
instillation["user"] = PFUser.currentUser()
instillation.saveInBackgroundWithBlock(nil)
self.performSegueWithIdentifier("toTimeline", sender: self)
} else {
// self.enterButton.enabled = false
self.errorAlert()
print("Couldn't log in...")
}
}
} else {
print("IT IS FALSE")
self.performSegueWithIdentifier("continueTheSignIn", sender: self)
// self.move()
}
The program will perform the toTimeline segue, but not the continueTheSignIn . I don't see any logical reason that this is not working. Could anyone point me in the right direction?
Also, I am having an error in my messages feature.
cell.textView!.linkTextAttributes = [NSForegroundColorAttributeName:cell.textView!.textColor]
This is giving me the error "Cannot assign a value of type '[String : UIColor?]' to a value of type '[String: AnyObject]!'
I was not previously getting this error in Swift / Xcode 6.4, so I don't know how to fix it.
Additionally, once I bypass this to get into my app to see if my other features are working, most of my UITableViews are not displaying any information. One is, however the rest load the correct amount of rows, but display nothing. What could this be? Also, no Parse pictures are being displayed correctly either. These are even more concerning than the other problems...
Here is the picture after I deleted and re added the segue under a diff. name.
Parse wont support the beta version . it needs a full version . I have contacted them based on a similar issue . They said they will update the parse to work with xcode7 once the full version of xcode7 is released.

Parse saveInBackgroundWithBlock crashes on iOS

I am adding some data into my parse class (table) successfully.
After saving is successfully completed (I can see the data on website), my app crashes without leaving any message on console. I tried to get a message by using "Enable Zombie Objects" setting. This is the message I am getting which has nothing to do what I am doing:
-[UIActivityIndicatorView release]: message sent to deallocated instance 0x126d16780
I do not have any UIActivityIndicatorView in my whole project.
This is how I save my data:
var currentUser = PFUser.currentUser()!
var userCase = PFObject(className: "Case")
userCase.relationForKey("user").addObject(currentUser)
userCase["caseCode"] = "test_code"
userCase.saveInBackgroundWithBlock {
(success: Bool, error: NSError?) -> Void in
if (success) {
// The object has been saved.
println("saved")
} else {
// There was a problem, check error.description
println("error occurred: \(error?.description)")
}
}
Swift SDK version: 1.7.5
Xcode version: 6.4
Has anybody have ever faced with such problem?
UPDATE: This error does not occur on simulator (tested on iPhone 5, iPhone 5S, iPhone 6) and does not occur on device at first run.
Tried removing and re-installing the app.
UPDATE 2: Removing PFFacebookUtils.initializeFacebookWithApplicationLaunchOptions(launchOptions) or changing it to PFFacebookUtils.initialize() from AppDelegate fixes the issue but I think I need to use initializeFacebookWithApplicationLaunchOptions(launchOptions). I have another problem now.
You may do the following.
1) Go to PFFacebookUtils.h
2) change:
(void)initializeFacebookWithApplicationLaunchOptions:(NSDictionary *)launchOptions;
To:
(void)initializeFacebookWithApplicationLaunchOptions:(PF_NULLABLE NSDictionary *)launchOptions;
It was originally posted here

Resources