joshuapinter / react-native-unified-contacts

Your best friend when working with the latest and greatest Contacts Framework in iOS 9+ in React Native.
MIT License
158 stars 56 forks source link

contacts don't always load on iOS 10.2 #15

Closed mlevkovsky closed 7 years ago

mlevkovsky commented 7 years ago

Some users of our app were saying how they can no longer load contacts. It used to work and now it just doesn't for them.

The only common thread that I was able to find between them is that they are on iOS 10.2 However, I am also using 10.2 and it loads fine.

Unfortunately I can't repro this. I was wondering if anybody else was experience this issue :/

joshuapinter commented 7 years ago

@mlevkovsky Anything iOS 9.0 and above should work just fine. I'm on iOS 10.2 and it works great.

One thing I would check is making sure that they have the Contacts permissions enabled on their phone.

If you can get me more information, we can debug this together.

mlevkovsky commented 7 years ago

@joshuapinter it works great for me as well (awesome library btw) I am double checking that permissions are enabled with the users although I would be surprised that that's the issue (since they use it before) I wish I had more details, feels like I'm flying blind 😞

joshuapinter commented 7 years ago

@mlevkovsky I know the feeling. 🙈 But seriously let me know what you find out and I'll get on it.

(And thanks for the compliment.) 👍

mlevkovsky commented 7 years ago

ya permissions are not the issue it seems. The user told me that it was working just fine and then stopped. Going to keep digging but not even sure what to ask them at this point

joshuapinter commented 7 years ago

Ask what it's doing: i.e. does it just show a spinner with "Loading Contacts" or does it go blank or anything?

joshuapinter commented 7 years ago

Also, depending on if your app's data is saved, maybe try and reinstall and see if that helps.

mlevkovsky commented 7 years ago

It's a fresh install, that's the weird part. I got a screenshot from the user and it's just blank a blank page, which is odd. So far this has been reported by 2 users. Very weird

joshuapinter commented 7 years ago

@mlevkovsky Strange. Keep me posted on any updates.

mlevkovsky commented 7 years ago

@joshuapinter will do for sure

mlevkovsky commented 7 years ago

@joshuapinter ok so I updated my xcode to 10.2 and I let Xcode update my swift version to the latest one. Now the RNUnifiedContacts.swift won't build. I'm not sure if it's related or not to the issues some users are having.

joshuapinter commented 7 years ago

@mlevkovsky Follow the new instructions on the README. They changed the way things build in XCode.

mlevkovsky commented 7 years ago

lol of course they did. thanks for the heads up!

mlevkovsky commented 7 years ago

@joshuapinter hmm ok so I re-added and re-installed the library but now, whenever I try to access the contacts I get this error Unhandled JS Exception: undefined is not an object (evaluating 'UnifiedContacts.requestAccessToContacts') and when I try to console.log the unified actions the object itself is undefined :/

joshuapinter commented 7 years ago

@mlevkovsky And when you added it, did you add the individual files, not the directory?

mlevkovsky commented 7 years ago

yup, just followed step by step added the files individually and then grouped them

joshuapinter commented 7 years ago

Can you go to your Build Settings and add $(SRCROOT)/../node_modules/react-native-unified-contacts/RNUnifiedContacts to the Header Search Paths?

mlevkovsky commented 7 years ago

that didn't work :/

joshuapinter commented 7 years ago

@mlevkovsky Drats. Okay. I'm not sure about ideas but can you try a few different things and see if you can get it to work. I'll try on my end, too.

mlevkovsky commented 7 years ago

@joshuapinter sure thing. I'll give it a shot on my end to see what's going on. I'll compare it against your example project as well

mlevkovsky commented 7 years ago

@joshuapinter aha so I figured it out. This might be a new xcode bug ("feature") but when you add the files to your project it actually ads them outside of the main workspace. All I had to do was drag them in in the side menu.

Still have no idea why contacts don't show up for some people, but at least I got it to building again heh

joshuapinter commented 7 years ago

@mlevkovsky 👏 Nicely done!

That's really bizarre. I'll play with it on my side and then look at updating the README.

joshuapinter commented 7 years ago

@mlevkovsky Can you test something for me?

Can you:

  1. Remove RNUnifiedContacts from your project's side bar and the iOS folder.

  2. Compile and confirm that it no longer works (i.e. Contacts is undefined, etc.).

  3. Drag and drop the RNUnifiedContacts folder from node_modules/react-native-unified-contacts into the sidebar.

  4. Check off Copy items if needed.

  5. Select Create groups

  6. Ensure your project is selected for a target.

  7. Click Finish.

  8. Recompile and see if it now works.

When you get a sec. Thanks!

Josh

mlevkovsky commented 7 years ago

@joshuapinter sure thing. I will try this over the weekend and get back to you

joshuapinter commented 7 years ago

Awesome, thanks.

FYI, here's a GIF I made for the new README instructions if your test works out: drag_and_drop_library_to_sidebar

mlevkovsky commented 7 years ago

@joshuapinter ah ok so dragging the folder should work now?

joshuapinter commented 7 years ago

@mlevkovsky It should work. Works for me but I want you to try it out and then I'll update the README instructions.

joshuapinter commented 7 years ago

@mlevkovsky Did you get a chance to test out the drag-n-drop?

mlevkovsky commented 7 years ago

@joshuapinter seems to work but only after I updated to swift 3 with the latest xcode 👍 I have to commend you on your work on this library man!

joshuapinter commented 7 years ago

@mlevkovsky Awesome, thanks for the update!