Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compatibility with XCode 7.3 #1639

Closed
jasssonpet opened this issue Mar 23, 2016 · 26 comments
Closed

Compatibility with XCode 7.3 #1639

jasssonpet opened this issue Mar 23, 2016 · 26 comments
Assignees
Milestone

Comments

@jasssonpet
Copy link
Contributor

jasssonpet commented Mar 23, 2016

From @NathanWalker on March 22, 2016 17:40

7.3 fixes a number of problems with 7.2, namely this very frustrating issue for us plugin developers:
NativeScript/ios-jsc#536

The only problem though is (as @raef mentioned on Slack), on subsequent build/runs:

Expected "/*", "//" or "{" but "<" found. It appears that platforms/ios/Pods/Pods.xcodeproj/project.pbxproj file is getting converted to XML when it is expected to be JSON.

If you remove platforms and add clean via tns platform add ios, everything builds and runs perfectly. Awesome.

So it appears the only issue is just subsequent runs after the platform has been added.
Any insight or patch that could be incorporated to resolve this would be very much appreciated.

Copied from original issue: NativeScript/ios-jsc#538

@jasssonpet
Copy link
Contributor Author

From @NathanWalker on March 22, 2016 18:31

To help in debugging the above for whomever may tackle the fix here:

  1. git clone https://github.com/bradmartin/nativescript-cardview.git
  2. npm run setup // you will see warnings, it's ok
  3. npm run demo.ios // more warnings, it will run just fine though

You should see Simulator open and the demo running properly.

Now stop ctrl + c, then:

cd demo
tns emulate ios

And you will see the error reported:

Expected "/*", "//" or "{" but "<" found.

@jasssonpet
Copy link
Contributor Author

From @NathanWalker on March 22, 2016 21:38

As reported by @raef (on slack) This appears to be a workaround for those working on NativeScript projects with CocoaPods.
Ensure you have this tool installed:

brew install xcproj

Then add this as an npm script (replace YourApp with your actual project name!!):

  • package.json
"scripts": {
   "ios": "xcproj --project platforms/ios/YourApp.xcodeproj touch; xcproj --project platforms/ios/Pods/Pods.xcodeproj touch; tns livesync ios --emulator --watch"
}

Then run everything through that so:

npm run ios

@jasssonpet
Copy link
Contributor Author

From @raefa on March 22, 2016 23:0

As discussed in the Slack iOS channel I got this going. Thanks to @alg as he helped me figure this out (doing a diff between his files and mine). So the issue is caused by “pod install” converting the “.pbxproj” files (within the xcodeproj files) to XML. NativeScript expects them to be in JSON. The problem is explained in a little more detail here: https://github.com/CocoaPods/CocoaPods/wiki/Generate-ASCII-format-xcodeproj

I don’t know why it changes or why it is only happening now with Xcode 7.3. I read here (https://github.com/CocoaPods/CocoaPods/wiki/Generate-ASCII-format-xcodeproj) that if you touch the files it converts them back to JSON. I tried the technique they specified but that did not work. So I installed xcproj (brew install xcproj see: https://github.com/0xced/xcproj/blob/develop/README.md) and then played around touching the project files. I found that I needed to convert both the platforms/ios/ExampleApp.xcodeproj (replace ExampleApp with your app name) and the platforms/ios/Pods/Pods.xcodeproj file. So to do that run:

xcproj --project "platforms/ios/ExampleApp.xcodeproj" touch
xcproj --project "platforms/ios/Pods/Pods.xcodeproj" touch

That is a bit of a pain to type in every time so I created some quick bash scripts to run to build. E.g.

#!/bin/bash
echo LiveSync to Simulator
xcproj --project "platforms/ios/HotHealthApp.xcodeproj" touch
xcproj --project "platforms/ios/Pods/Pods.xcodeproj" touch
tns livesync ios --emulator --watch

I hope that helps.

@jasssonpet
Copy link
Contributor Author

So to sum it up - CocoaPods updates the Xcode project to XML format and node-xcode is not being able to parse xml projects. I'm moving this to the CLI repo.

@maknz
Copy link

maknz commented Mar 28, 2016

Argh, 👍, this caught me out.

@manijak
Copy link

manijak commented Apr 8, 2016

I updated to xcode 7.3 today, and I have no such issues... my app uses 2-3 pods also. I can build & run the app several times both via cli and via xcode.

@Mitko-Kerezov
Copy link
Contributor

As @jasssonpet said this is probably a Cocoa Pods issue
@NathanWalker @manijak can you guys run $ pod --version inside a terminal and tell me your Cocoa Pods' versions

@manijak
Copy link

manijak commented Apr 13, 2016

@Mitko-Kerezov my version is 0.39.0

@NathanWalker
Copy link
Contributor

@Mitko-Kerezov 0.39.0 here as well.

@Mitko-Kerezov
Copy link
Contributor

All right - now I too seem to be getting 100% reproduction
@manijak can you tell me which pods your project uses exactly - it might be that the issue only applies to specific pods

@manijak
Copy link

manijak commented Apr 15, 2016

@Mitko-Kerezov

  • NYTPhotoViewer
  • FLAnimatedImage
  • Google/Analytics

There are probably some dependencies in each of them. Don't know what is the best way to get a full list here, they seem to be spread to diferent folders in platforms/ios/Pods

@Mitko-Kerezov
Copy link
Contributor

Issue seems to have disappeared in Cocoa Pods 1.0.0 beta releases

@NathanWalker
Copy link
Contributor

@Mitko-Kerezov Does this mean we should all just update to Cocoa Pods 1.0.0 beta? Or should we wait til' {N} ios-runtime 1.7.2?

@Mitko-Kerezov Mitko-Kerezov modified the milestones: 2.0, 1.7.2 Apr 18, 2016
@Mitko-Kerezov
Copy link
Contributor

@NathanWalker
Bottom line:
The issue is only reproduced with Xcode 7.3 and CocoaPods < 1.0.0. Lower versions of CocoaPods don't support Xcode 7.3 yet and will not in the near future.
The workaround proposed by @jasssonpet will be implemented in NatvieScript CLI's next release - 2.0.0 so currently there are three options in total - either wait for NativeScript CLI 2.0.0, upgrade to the latest CocoaPods beta, or use @jasssonpet's workaround

@NathanWalker
Copy link
Contributor

NathanWalker commented Apr 18, 2016

@Mitko-Kerezov So I updated to latest CocoaPods beta 1.0.0.beta.8 and I now get warnings like this during compile:

[!] CocoaPods did not set the base configuration of your project because your project already has a custom config set. In order for CocoaPods integration to work at all, please either set the base configurations of the target `demo` to `Pods/Target Support Files/Pods-demo/Pods-demo.debug.xcconfig` or include the `Pods/Target Support Files/Pods-demo/Pods-demo.debug.xcconfig` in your build configuration (`demo/build-debug.xcconfig`).

[!] CocoaPods did not set the base configuration of your project because your project already has a custom config set. In order for CocoaPods integration to work at all, please either set the base configurations of the target `demo` to `Pods/Target Support Files/Pods-demo/Pods-demo.release.xcconfig` or include the `Pods/Target Support Files/Pods-demo/Pods-demo.release.xcconfig` in your build configuration (`demo/build-release.xcconfig`).

Then it finally errors with this:

diff: /../Podfile.lock: No such file or directory
diff: /Manifest.lock: No such file or directory
error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.

I tried running pod install in the platform/ios directory as it mentions but no dice.
I've also searched around for those pod errors and have yet to find a solution. Do you know what would work to get me past ^ all that with latest CocoaPods beta 1.0.0.beta.8

@Mitko-Kerezov
Copy link
Contributor

@NathanWalker Sorry for the late reply
I think the issue you're describing may be derived from the fact that you haven't cleared (removed) the platforms directory in your project prior to building with the new CocoaPods.
I'm going to go ahead and add a disclaimer here stating that even if you cleaned your platforms directory, you'd probably hit #1611

Luckily, however, all of these problems will be solved in the upcoming 2.0.0 release which should be out by the start of next week.

Until release however I strongly suggest switching back to CocoaPods 0.39.0 and using the workaround described by @jasssonpet

@NathanaelA

This comment was marked as abuse.

@Mitko-Kerezov
Copy link
Contributor

@NathanaelA
2.0 does not require CocoaPods 1.0 beta. In 2.0 if the CLI detects a troublesome configuration (e.g. Xcode 7.3 and CocoaPods 0.39.0) a message is displayed telling users to install the xcproj command line tool. Underneath, the CLI uses said tool to restore the main .pbxproj back to the ASCII format.

So in theory every configuration should work - regardless of Xcode and CocoaPods versions.
@NathanaelA could the reports you mentioned be related to CLI 1.7.x users?

@NathanaelA

This comment was marked as abuse.

@Mitko-Kerezov
Copy link
Contributor

Sounds good - any feedback would be much appreciated

@NathanaelA

This comment was marked as abuse.

@x4080
Copy link

x4080 commented May 7, 2016

@NathanaelA is 2.0 stable enough in iOS? If so how about in Android? I read there are issues posted by people ?

Thanks

@firescript
Copy link

I'm getting this issue again on xcode 8 with ios 10, is any one else?
Expected "/*", "//" or "{" but "<" found.

@ignaciolarranaga
Copy link

Me too. Seems it reappears.

@firescript
Copy link

@ignaciolarranaga check this comment out, will fix you up hopefully: NativeScript/NativeScript#2703 (comment)

@ignaciolarranaga
Copy link

@firescript thanks !, but I think it is happening again, check my comments at the issue: #2062

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

No branches or pull requests