Skip to content
This repository has been archived by the owner on Jan 18, 2023. It is now read-only.

Can't find variable MaterialCardView on iOS #12

Closed
burkeholland opened this issue Mar 18, 2016 · 11 comments
Closed

Can't find variable MaterialCardView on iOS #12

burkeholland opened this issue Mar 18, 2016 · 11 comments

Comments

@burkeholland
Copy link

When I try and use the plugin, it throws an error Can't find variable MaterialCardView on iOS. If I try and do a tns debug ios --emulator, it throws a wall of Swift linking errors.

System

NativeScript 1.7
iOS 9.2
Xcode 7.2.1

Steps To Reproduce

tns create my-app && cd my-app && tns platform add ios
tns plugin add nativescript-cardview

Add the following markup to your page

<page xmlns="http://schemas.nativescript.org/tns.xsd"                
      xmlns:card="nativescript-cardview">

      <stack-layout><!-- Home page contents -->
        <card:CardView margin="10">
           <grid-layout rows="200, auto, auto" columns="auto, auto, *">
               <image src="~/images/batman.jpg" stretch="aspectFill" colSpan="3" row="0" />
               <label text="Batman wants to be friends?" class="info" textWrap="true" row="1" colSpan="3" />          
               <button text="DECLINE" tap="goAway" class="clear-btn blue" row="2" col="0" />
               <button text="ACCEPT" class="clear-btn blue" row="2" col="1" />
           </grid-layout>
        </card:CardView>
      </stack-layout>

</page>

Run in the emulator

tns deploy ios --emulator

Error is thrown

Mar 18 16:37:11 hollandmac nativescriptnova[6301]: file:///app/tns_modules/ui/builder/builder.js:154:56: JS ERROR Error: Building UI from XML. @file:///app/pages/cards/simple-card.xml:16:9
     ↳Module '/Users/burkeholland/Library/Developer/CoreSimulator/Devices/FAE7B936-79CE-46C4-859F-65506A603837/data/Containers/Bundle/Application/4B9CC923-5319-4FD0-AE7D-37449DA4E814/nativescriptnova.app/app/tns_modules/nativescript-cardview' not found for element 'nativescript-cardview:CardView'.
       ↳Can't find variable: MaterialCardView
Mar 18 16:37:11 hollandmac com.apple.CoreSimulator.SimDevice.FAE7B936-79CE-46C4-859F-65506A603837.launchd_sim[2575] (UIKitApplication:org.nativescript.nativescriptnova[0x330e][6301]): Service exited due to signal: Segmentation fault: 11

Run tns debug ios --emulator. I've attached the text file with the linker errors.
linker.txt

Suggested Solution

I'm pretty sure iOS simply can't build that CocoaPod. I noticed that the target version for the Pod is 8.0, but that should just be the minimum version, not the absolute target version. I check the CocoaPod docs for Podfiles and there was no mention of a minimum version, only a target version.

I have no idea.

@NathanWalker
Copy link
Member

I'll investigate this weekend.

In meantime, try this:

Open the .xcworkspace file in the platforms/ios folder, then run the 2nd target (it will have a '2' next to it in the available run targets drop down in XCode). Lemme know if it runs that way.

@burkeholland
Copy link
Author

I was able to build the 2nd target in Xcode successfully.

@NathanWalker
Copy link
Member

I'm working on a much simpler and stable Material Design Card View for iOS.
About have it done locally, it will end up here:
https://github.com/NathanWalker/MaterialCard

That iOS version will be published as CocoaPod to then be used here. I'll post back when it's all complete and ready.

NathanWalker added a commit to NathanWalker/nativescript-cardview that referenced this issue Mar 21, 2016
@NathanWalker
Copy link
Member

@burkeholland I've posted an issue here about some things I found while debugging this issue:
NativeScript/ios-jsc#536

Additionally, it's worth noting that using tns run ios will work fine. It's isolated to emulating via the Simulator. The workaround mentioned above is the only way at the moment to run this plugin in the iOS Simulator.

@burkeholland
Copy link
Author

Looks like Xcode 7.3 fixes the issue with having to downgrade. Nice troubleshooting BTW. Well done. I'll change my version and see what happens.

@NathanWalker
Copy link
Member

The new XCode 7.3 does fix the issue on a "fresh add and run". Subsequent runs will result in strange error:
NativeScript/ios-jsc#538

Hopefully will be fixed soon. But good news is yes 7.3 does solve the issue. Hooray!
Just be sure to run this everytime:

rm -rf demo/platforms
npm run demo.ios

....to demo this plugin successfully until the runtime is fixed.

I'm about to release a new version of this which makes the iOS side even better using the new simpler implementation and new properties which can be set to customize it's look.

@NathanWalker
Copy link
Member

1.1.0 released and available now.

@bradmartin
Copy link
Collaborator

This good @NathanWalker @burkeholland ?

@NathanWalker
Copy link
Member

Still awaiting ios runtime/cli 1.7.2 actually:
NativeScript/nativescript-cli#1639

Shouldn't be much longer.

@bradmartin
Copy link
Collaborator

2.0.0 fix this? Just cleaning issues, no rush or worries.

@jlooper
Copy link

jlooper commented Jun 6, 2016

Reporting back! I ran into this issue but it appeared to be because the MaterialCard cocoapod didn't initially install. I opened Xcode and built the target as recommended above, and the pod was installed and the card shows up using livesync. So ... I think you can close this, Nathan! Thanks, everyone!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants