React Native : iOS - Use of undeclared identifier 'UIUserInterfaceIdiomCarPlay'



        Hi there, i'm back with React Native + iOS, i'm hope to see anything smooth and clearly but since React Native + Android let me getting start with issue, i'm really sure iOS have been also. Then after i'm done generate new react native project and open with xcode.

        I must fix free provision developer account and after that, i'm connect iphone 6s and click play, Aha! an error occur.
Please reading this guide first https://facebook.github.io/react-native/docs/getting-started.html

RCTPlatform.m:26:10: Use of undeclared identifier 'UIUserInterfaceIdiomCarPlay'; did you mean 'UIUserInterfaceIdiomPad'?

But you already have that, so i'm just comment out in file "RCTPlatform.m" under function "static NSString *interfaceIdiom(UIUserInterfaceIdiom idiom)" like this.

//    case UIUserInterfaceIdiomCarPlay:
//      return @"carplay";


        Well Em, it's not quite good surely but i'm newbie programmer, LOL. don't be shy, learn all the time. I'm click play again and pray for xcode then an error occur again in new file "RCTTabBarItem.m" under function "(void)setBadgeColor:(UIColor *)badgeColor" like this.

RCTTabBarItem.m:111:12: Property 'badgeColor' not found on object of type 'UITabBarItem *'

i'm comment out this function bcoz after i'm comment one line it's tell me this function unused,

/*
- (void)setBadgeColor:(UIColor *)badgeColor
{
#if !TARGET_OS_TV && defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_10_0
  _barItem.badgeColor = badgeColor;
#endif
}
*/


        Bad luck, i'm founded new error, Hmm React Native + iOS harder than Android. In file "RCTTabBar.m" under function "(void)setUnselectedItemTintColor:(UIColor *)unselectedItemTintColor" like this.


RCTTabBar.m:155:27: Property 'unselectedItemTintColor' not found on object of type 'UITabBar *'; did you mean 'selectedImageTintColor'?

OK, some feature is deprecated but it's suggestion by automate, i'm not care just comment out this line.

//    _tabController.tabBar.unselectedItemTintColor = unselectedItemTintColor;


LOL, it's take me more error but it's jump to file "RCTProfile.m"

RCTProfile.m:386:70: Expected ')'

and this...

RCTProfile.m:386:57: Incompatible block pointer types assigning to 'UIActivityViewControllerCompletionWithItemsHandler _Nullable' (aka 'void (^)(NSString * _Nullable __strong, BOOL, NSArray * _Nullable __strong, NSError * _Nullable __strong)') from 'int ((^)(void))'

How can i get rid all of this shit?, hmm... this is quite a bit harder after i'm try to change from xcode suggestion i can do that by change this line.


activityViewController.completionWithItemsHandler = ^(__unused UIActivityType activityType,
to

activityViewController.completionWithItemsHandler = ^(__unused NSString *activityType,

        HOORAY!! Now everything fine, i can compile and run my first React Native + iOS on iPhone 6S, the result is look like below image. From my suggestion you need to test by yourself, the difference environment will be difference result, i'm need to learn more about this before develop seriously app/game, it's may lead me in many trouble in the future if i'm foolish keep an old trend.

 

Test Environment
- Mac OSX Yosemite
- React Native
- Xcode 7.2.1
- iPhone 6S (iOS 9.1)

See you next post :)

Comments

  1. This helped. Thanks

    ReplyDelete
  2. Great article. I got it work without a need to upgrade xcode to 8. Thanks a lot!

    ReplyDelete
  3. what your react native version?

    but i'm error in this code RTCLinkingManager.h

    #import << not found

    @interface RCTLinkingManager : RCTEventEmitter

    + (BOOL)application:(UIApplication *)app
    openURL:(NSURL *)URL
    options:(NSDictionary *)options; << No type or protocol named 'UIApplicationOpenURLOptionsKey'

    ReplyDelete
    Replies
    1. I'm not reminded, it's been a long time so i guess it's older than your version. You may need to start from latest version both React Native and Xcode 9.2

      Delete

Post a Comment