I've used different Xcode versions in the past and now I started using Xcode 10.1 on a new mac mini 2018. As soon as I created a new project I get this error. error that I encounter

As the user is typing in a new user name on the registration screen, the text in userNameTextField is checked against Firebase Realtime Database to make sure that the username isn't already taken. Works great!

If you just delete a letter or two after you begin typing, no problem. But if you delete all the letters after starting to type, the iOS simulator crashes. Here's the code:

@IBAction func userNameTextFieldEditingChanged(_ sender: Any) {
    Auth.auth().signInAnonymously { (user, error) in

        if let error = error
        {
            self.showMessage(messageToDisplay: error.localizedDescription)
            return
        }

        if user != nil {
            var databaseReference: DatabaseReference!
            databaseReference = Database.database().reference()
            Database.database().reference().child("allUsers").child(self.userNameTextField.text!).observeSingleEvent(of: .value, with: {(usernameSnap) in

                if usernameSnap.exists(){
                    self.userNameStatusLabel.text = "Username is already taken."
                    self.nextButton.isEnabled = false
                    self.nextButton.alpha = 0.25
                } else{
                    self.userNameStatusLabel.text = ""
                }

            })
        }   
    }
}

After the app crashes, it shows me the AppDelegate in Xcode with the message "Thread 1: signal SIGABRT" after the line "class AppDelegate: UIResponder, UIApplicationDelegate {"

In the debug area below, the message reads "libc++abi.dylib: terminating with uncaught exception of type NSException (lldb)"

Any idea why it is crashing and how to fix it? Any help is appreciated!

Is there are a way to stop tracking in_app_purchase Firebase automatically collected event on iOS?

Currently building a mobile application that ideally would have functionality that allows one user to "nudge" another user, pretty much the equivalent to a Facebook "poke." For the sake of building quickly, we'd like to use as many third-party libraries/services as possible. So far we were looking into using pusher and expo, but to be totally honest, we are a bit confused as to how to architecture this.

From what I understand, the front-end (ios app) would subscribe (open a socket) to a specific channel/server and the server would then send messages to the client(s) that subscribed whenever necessary. How this works with users being subscribed to every other user they are friends with, I don't understand. What's the proper way to architecture this?

I also read that on the front end, when a user doesn't have the ios application open you can't have any websockets open to the server, so how does that work?

Additionally, how does one bundle notifications??

Really confused with this, any help would be greatly appreciated.

Chris

I have an app using the standard implementation of Messagekit but the didTapMessage event isn't firing when I tap the message text (the didTapAvatar function isn't run at all either). I'm not using a custom cell so I don't think I need to use a custom gesture recognizer.

Here's the relevant code:

import UIKit
import Firebase
import FirebaseFirestore
import MessageKit
import MessageInputBar

class ChatViewController: MessagesViewController {

    // MARK: Lifecycle
    override func viewDidLoad() {
        super.viewDidLoad()

        messageInputBar.delegate = self
        messagesCollectionView.messagesDataSource = self
        messagesCollectionView.messagesLayoutDelegate = self
        messagesCollectionView.messagesDisplayDelegate = self

        .....

        }

    // MARK: Properties

    ...
}

extension ChatViewController: MessagesDataSource {

    func currentSender() -> Sender {
        //guard let currentUserID = User.current?.key else {return nil}
        let newSender = Sender(id: (User.current?.key)!, displayName: (User.current?.username)!)
        return newSender
    }

    func numberOfSections(in messagesCollectionView: MessagesCollectionView) -> Int {
        //return 1
        return messages.count
    }

    func messageForItem(at indexPath: IndexPath, in messagesCollectionView: MessagesCollectionView) -> MessageType {
        return messages[indexPath.section]

        func cellTopLabelAttributedText(for message: MessageType, at indexPath: IndexPath) -> NSAttributedString? {

            return NSAttributedString(string: MessageKitDateFormatter.shared.string(from: message.sentDate), attributes: [NSAttributedString.Key.font: UIFont.boldSystemFont(ofSize: 10), NSAttributedString.Key.foregroundColor: UIColor.darkGray])
        }

        func messageTopLabelAttributedText(for message: MessageType, at indexPath: IndexPath) -> NSAttributedString? {
            let name = message.sender.displayName
            return NSAttributedString(string: name, attributes: [NSAttributedString.Key.font: UIFont.preferredFont(forTextStyle: .caption1)])
        }

        func messageBottomLabelAttributedText(for message: MessageType, at indexPath: IndexPath) -> NSAttributedString? {

            let dateString = formatter.string(from: message.sentDate)
            return NSAttributedString(string: dateString, attributes: [NSAttributedString.Key.font: UIFont.preferredFont(forTextStyle: .caption2)])
        }
    }
}

extension ChatViewController: MessagesDisplayDelegate, MessagesLayoutDelegate {}

extension ChatViewController: MessageCellDelegate {

    func didTapAvatar(in cell: MessageCollectionViewCell) {
        print("Avatar tapped")
    }

    func didTapMessage(in cell: MessageCollectionViewCell) {
        print("Message tapped")

    }

    func didTapCellTopLabel(in cell: MessageCollectionViewCell) {
        print("Top cell label tapped")
    }

    func didTapMessageTopLabel(in cell: MessageCollectionViewCell) {
        print("Top message label tapped")
    }

    func didTapMessageBottomLabel(in cell: MessageCollectionViewCell) {
        print("Bottom label tapped")
    }

    func didTapAccessoryView(in cell: MessageCollectionViewCell) {
        print("Accessory view tapped")
    }
}

extension ChatViewController: MessageInputBarDelegate {
    func messageInputBar(
        _ inputBar: MessageInputBar,
        didPressSendButtonWith text: String) {
        ....
    }
}

Any ideas? Thanks!

I've created an extension for UIView that allows me to make a concave shape.

extension UIView {
    func createConcave(depth: CGFloat) {
    let width = self.bounds.width
    let height = self.bounds.height

    let path = UIBezierPath()
    let p0 = CGPoint(x: 0, y: 0)
    let p2 = CGPoint(x: width, y: 0)
    let p1 = CGPoint(x: width / 2, y: depth)
    path.move(to: p0)
    path.addQuadCurve(to: p2, controlPoint: p1)
    path.addLine(to: CGPoint(x: width, y: height))
    path.addLine(to: CGPoint(x: 0, y: height))
    path.addLine(to: p0)
    let mask = CAShapeLayer()
    mask.path = path.cgPath
    self.layer.mask = mask
    self.layer.masksToBounds = false
    }
}

The shape of the UIView after implementing concavity

What would be a good solution to add a shadow to the view that matches the shape? Would I have to specify the shadow path to be the same path as the concave shape?

Can my viewcontroller be generic and still contain IBOutlet?

class AViewController<T> : SuperViewController, Decodable where T : Decodable {

    @IBOutlet weak var leftButton: UIButton!
    @IBOutlet weak var rightButton: UIButton!

    var pop : T?

}

will this impleemntation works? it throws me an error. Type AViewController does not conform to decodable.

I have been researching this for the past few weeks and working to try to see if how it is possible to setup https://github.com/facebook/WebDriverAgent and in particular XCTest's to be able to be deployed and ran in test mode from Linux.

At this point I can use xcodebuild build-for-testing or test which will build the WDA App (XCTest unit tests) on MacOSX and then deploy it onto the phone and run it as Test. This allows the XCTest libraries to be loaded and then allows interaction between WDA and automation on the phone via the XCTest framework.

I am wondering if there is some way to either extend ideviceinstaller, libimobiledevice or ios-deploy or some other solution to support pushing the Test build to a real iOS device from Linux.

Main Question

  • How can I run a iOS App which has been built on MacOSX using the Test build containing XCTest unit tests from Linux to a iOS device?

I have seen commercial products which provide this so there must be a way to do this but I am currently stuck trying to determine how to do this.

My apple account is registered in Taiwan. If I want to poblish my application to other countries, such as mainland China, do I need to register for a Chinese account? Can I continue to use my Taiwanese developer account to publish my app to China?

I need to pass an IF statement to a method. In JavaScript you can assign a function to a variable. Then that variable can be passed to a function and executed. Does this exist in Objective-C?

This is the pattern I'd like to implement:

-(void)singleComparisonWith:(NSArray *)data
                 IndexBegin:(NSUInteger)indexBegin
                   IndexEnd:(NSUInteger)indexEnd
                  Threshold:(float)threshold {

    NSIndexSet *set1 = [self searchWithData:data
                                      Range:[self makeInspectionWithRange:indexBegin
                                                                      End:indexEnd]
                                     Option:NSEnumerationConcurrent
                                 Comparison:XXXXXXXXX];
// XXXXXXXXX is an IF statement that looks for value at an index above threshold
}

-(void)rangeComparisonWith:(NSArray *)data
                IndexBegin:(NSUInteger)indexBegin
                  IndexEnd:(NSUInteger)indexEnd
              ThresholdLow:(float)thresholdLow
             ThresholdHigh:(float)thresholdHigh {

    NSIndexSet *candidates = [self searchWithData:data
                                               Range:[self makeInspectionWithRange:indexBegin
                                                                               End:indexEnd]
                                              Option:NSEnumerationReverse
                                          Comparison:YYYYYYYYY];
// YYYYYYYYY is an IF statement that looks for value at an index above thresholdLow and above thresholdHigh
}

-(NSIndexSet *)searchWithData:data
                        Range:(NSIndexSet *)range
                       Option:(NSEnumerationOptions)option
                   Comparison:(id)comparison {

    return [data indexesOfObjectsAtIndexes:range
                                   options:option
                               passingTest:^(id obj, NSUInteger idx, BOOL *stop){
// Comparison is used here. Returns YES if conditions(s) are met.
                               }
            ];
}

EDIT:

I'm close, but I'm getting errors.

NSIndexSet *set1 = [self searchWithData:data
                                  Range:[self makeInspectionWithRange:indexBegin
                                                                  End:indexEnd]
                                 Option:NSEnumerationConcurrent
                             Comparison:void(^)(o, NSNumber, BOOL *) {
                                return [o floatValue] > threshold;
                             }
                    ];

Expected expression on void(^)(o

-(NSIndexSet *)searchWithData:data
                        Range:(NSIndexSet *)range
                       Option:(NSEnumerationOptions)option
                   Comparison:void(^)(o, NSNumber, BOOL *)comparison {

    return [data indexesOfObjectsAtIndexes:range
                                   options:option
                               passingTest:^(id obj, NSUInteger idx, BOOL *stop){
                                   return [comparison obj];
                               }
            ];

Expected identifieron void(^)(o

Incompatible block pointer types sending 'void (^)(__strong id, NSUInteger, BOOL *)' to parameter of type 'BOOL (^ _Nonnull)(id _Nonnull __strong, NSUInteger, BOOL * _Nonnull)' on passingTest:^(id obj

Use of undeclared identifier 'comparison' on eturn [comparison obj];

Thank you for your help.

I am working on a mapbox map and want to use the clustering feature found here. So I copied the code and need to know instert my data instead of the example one.

The problem, however, is that I do not know how I should do that. Bellow is the line where I need to input my own data (a bunch of MGLPolylines) how shoudl I do that?

 let source = MGLShapeSource(identifier: "clusteredPorts",
                                    url: url,
                                    options: [.clustered: true, .clusterRadius: icon!.size.width])

Edit: I have seen that this was asked here, however it has not gotten an updated answer. Has anything changed?

I have been trying:

            var array = [MGLPolyline]()
        for val in arrayOfLineInformationObjects {
            array.append(val.polyline!)
        }
        let source = MGLShapeSource(identifier: "clusteredPorts", shapes: array, options: [.clustered: true, .clusterRadius: 100])

But to no avail.

Update: I have found the following https://github.com/hulab/ClusterKit/but am unsure if this is teh best option.

How to disable proguard for espresso test.

I enabled proguard for debug build type. But i want to disable proguard for espresso debug tests.

debug {
        minifyEnabled true
        shrinkResources true
        useProguard true
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        testProguardFile 'test-proguard-project.pro'
    }

and my test-proguard-project.pro looks like

-dontoptimize
-dontwarn
-dontobfuscate

Still proguard is optimizing the test app. Please help me how to disable proguard for test app.

This question already has an answer here:

I have been learning to code on my own and i'm really stuck here... I am trying to get data from Room Database that i can manipulate and based on it to create Live Data list which can be observed. Here's the code with the problem:

public class Access {

private dao;
private MutableLiveData<List<Element>> currentItem;
private MutableLiveData<List<Element>> nextItem;
private static int cursor = 1;

// THE CONSTRUCTOR

public Access(Application application){
    MyDatabase myDatabase = MyDatabase.getInstance(application);
    Dao = myDatabase.dao();
    try {
        currentItem = new GetFirstItem(dao).execute().get();
    } catch (ExecutionException e) {
        e.printStackTrace();
    } catch (InterruptedException e) {
        e.printStackTrace();
    }
}

 private static class GetFirstItem extends AsyncTask<Void, Void, MutableLiveData<List<Element>>> {

    List<Element> temporaryResult = new ArrayList<>();
    MutableLiveData<List<Element>> result = new MutableLiveData<>();
    Dao dao;
    boolean loopCheck = true;
    String checkedName;
    Element checkedElement;

    private GetFirstItem(Dao dao) {this.dao =dao;}
    @Override
    protected synchronized MutableLiveData<List<Element>> doInBackground(Void... voids){
        while(loopCheck == true){
            checkedElement = dao.getCurrentElement(cursor);
            checkedName = dao.getCurrentElementName(cursor);
            System.out.println(checkedElement);
            System.out.println(checkedName);
            if(!checkedName.contains("X")){
                temporaryResult.add(checkedElement);
                cursor = cursor+1;
                System.out.println("DONE ONCE");
            }
            else{
                temporaryResult.add(checkedElement);
                cursor = cursor +1;
                loopCheck =false;
                System.out.println("DONE ONCE");
            }
        }
        result.postValue(temporaryResult);
        return result;
    }
}

And the error: Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.lang.String.contains(java.lang.CharSequence)' on a null object reference...

I know what a null pointer exception is ... i don't know why that value is null considering Sysout always prints a value...

i have this in main activity

package com.android.myapp;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.webkit.WebView;
import android.webkit.WebViewClient;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        WebView webb =(WebView)findViewById(R.id.strona);
        webb.setWebViewClient(new WebViewClient());
        webb.loadUrl("https://myapp.pl");
    }
}

and this in androidmanifest.xml

<uses-permission android:name="android.permission.INTERNET"></uses-permission>
<uses-permission android:name="android.permission.CAMERA"></uses-permission>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"></uses-permission>

and not working open camera when i click "browse file"

In an Activity, I get the following error which is completely unexplainable to me:

Cannot resolve symbol fileUri

The aim is to pass a Camera Intent to an Image Stream. What is the problem with this Code Snippet? What am I missing here?

public void open(){
        Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); //IMAGE CAPTURE CODE
        Intent.putExtra(MediaStore.EXTRA_OUTPUT, fileUri);
    }

Android Guru.

Can anyone explain to me why the breakpoint does not stop in Fragment and Adapter, only stop in the Activity page.

Please advise.

Im trying to implement this solution using Google Jetpack Navigation component and still struggle with back stack issue.

The problem I'm facing is custom implementation of navigate method in FragmentNavigator class breaks existing logic of back stack.

if I try to add simple behaviour like:

transaction.addToBackStack(tag)

then BottomNavigationView is not highlighting/selecting buttons properly for current active fragment when back button is pressed.

My question how to implement properly custom back stack using such approach that works correctly with BottomNavigationView and properly using back pressed listener to override more advanced custom back stack that put right navigation in the same BottomNavigationView.

The naive approach would be override onBackPressed in activity and then just create own logic separately and manually use navController.navigate to simulate back stack functionality, but I would like to hear how this problem can be solved with BottomNavigationView, NavController, NavHostFragment, FragmentNavigator scope.

I've created an adapter with an OnItemClickListener and set it to a check box. I've succeeded in making the check box toggle a Boolean value in Firebase firestore but it takes 2 clicks to change the value. When clicking the check box it doesn't toggle to checked until the second click. The same goes for unchecking.

The method is called in onCreate.

"done" is the Boolean field in my database.

The check box is on a recycler view nested in another recycler view. This is why it has a nested collection/document and a variable for an ID. I excluded the intents used to create the variables.

private void setUpCheckBox() {

    adapter.setOnItemClickListener(new ToDoAdapter.OnItemClickListener() {

        @Override
        public void onItemClick(DocumentSnapshot documentSnapshot, final int 
        position) {

        final CheckBox checkBox = (CheckBox) findViewById(R.id.checkBox_complete);


            Map<String, Object> done = new HashMap<>();

            if (checkBox.isChecked()) {
                checkBox.setChecked(true);
                done.put("done", true);
            }
            if (!checkBox.isChecked()) {
                checkBox.setChecked(false);
                done.put("done", false);
            }

            db.collection("customer2").document(id1).collection("To Do").document(id2)
                    .set(done, SetOptions.merge())
                    .addOnSuccessListener(new OnSuccessListener<Void>() {
                        @Override
                        public void onSuccess(Void aVoid) {
                            Toast.makeText(CustomerProfile.this, id2, Toast.LENGTH_SHORT).show();

                        }

                    });
        }
    });
}

This is a nested Class in my adapter Class.

private OnItemClickListener listener;

listener is declared in parent class.

class ToDoHolder extends RecyclerView.ViewHolder {

    CheckBox checkBoxComplete;

    public ToDoHolder(@NonNull View itemView) {
        super(itemView);

        checkBoxComplete = itemView.findViewById(R.id.checkBox_complete);

        checkBoxComplete.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                int position = getAdapterPosition();
                if (position != RecyclerView.NO_POSITION && listener != null) {
                    listener.onItemClick(getSnapshots().getSnapshot(position), position);
                }
            }
        });
    }
}
public interface OnItemClickListener {
    void onItemClick(DocumentSnapshot documentSnapshot, int position);
}
public void setOnItemClickListener(OnItemClickListener listener){
    this.listener = listener;

}

}

I want to disable the next day but not the previous day. I have found out how to disable it for the next day, but for the previous day it was also disabled. Please help me

This is my code

public class Kegiatan extends AppCompatActivity {

private CalendarView calendarKegiatan;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_kegiatan);

    calendarKegiatan = (CalendarView) findViewById(R.id.calendarKegiatan);

    calendarKegiatan.setOnDateChangeListener(new CalendarView.OnDateChangeListener() {
        @Override
        public void onSelectedDayChange(@NonNull CalendarView view, int year, int month, int day) {

            Date getdate = Calendar.getInstance().getTime();

            SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy/M/d");
            String dateNow = dateFormat.format(getdate);
            String date = year + "/" + (month + 1) + "/" + day;

            if (date.equals(dateNow)) {
                Intent intent = new Intent(Kegiatan.this, ListKegiatan.class);
                intent.putExtra("tanggal", date);
                startActivity(intent);
            } else {
                Toast.makeText(Kegiatan.this, "Dilarang laporan di hari selanjutnya", Toast.LENGTH_SHORT).show();
            }
        }
    });
    calendarKegiatan.setFocusedMonthDateColor(Color.GREEN);


}

}

I was working on my project yesterday and everything was going fine. Today when I opened it up, it failed to build. I don't understand this because I did not touch my dependencies at all yesterday. I did all the things I could think of. I rebuilt the project multiple times,cleaned it, invalidate cache / restart , sync project with gradle files and it still doesn't work. Please help!

My app level build.gradle build.gradle Error

I have made a Second Hand Book Recycler Application in Android. I used Firebase for the real time online DB. But the problem is I cannot perform a proper and powerful search. Firebase only supports a few starAt and endAt functions. When I was trying to embed a search, I have searched and got a few names, which are in the paid domain. Algolia etc. Are there any free and easy alternative. Is the AWS better than Firebase in this sense ?