Configure Eureka and Zuul to redirect connection to #RestController - netflix-zuul

I have 2 simple projects that I want to integrate. One is composed by Zuul and Eureka, while the other one is a simple web project.
I want to redirect all requests from localhost:8761/books to localhost:8081. I have, for example, a endpoint localhost:8081/test that I would like to access through localhost:8761/books/test
When I start both applications, I can see that my Web project registrates in Eureka (BOOK n/a (1) (1) UP (1) - 10.0.1.5:book:8081), but when I access localhost:8761/books/test, I get the exception appended at the end of this post. Here are the basic configurations.
Web project
build.grade:
...
dependencies {
compile('org.springframework.cloud:spring-cloud-starter-eureka')
compile('org.springframework.boot:spring-boot-starter-web')
compile('org.codehaus.groovy:groovy')
testCompile('org.springframework.boot:spring-boot-starter-test')
}
...
bootstrap.properties:
spring.application.name=book
server.port=8081
Zuul/Eureka project
build.grade:
...
dependencies {
compile('org.springframework.cloud:spring-cloud-starter-eureka-server')
compile('org.springframework.cloud:spring-cloud-starter-zuul')
compile('org.codehaus.groovy:groovy')
testCompile('org.springframework.boot:spring-boot-starter-test')
}
...
application.properties:
zuul.routes.book.path=/books/**
zuul.routes.book.service-id=book
server.port=8761
eureka.instance.hostname=localhost
eureka.client.register-with-eureka=false
eureka.client.fetch-registry=false
eureka.client.service-url.default-zone=http://${eureka.instance.hostname}:${server.port}/eureka/
logging.level.com.netflix.eureka=OFF
logging.level.com.netflix.discovery=OFF
Exception:
com.netflix.zuul.exception.ZuulException: Forwarding error
at org.springframework.cloud.netflix.zuul.filters.route.RibbonRoutingFilter.handleException(RibbonRoutingFilter.java:158) ~[spring-cloud-netflix-core-1.1.5.RELEASE.jar:1.1.5.RELEASE]
at org.springframework.cloud.netflix.zuul.filters.route.RibbonRoutingFilter.forward(RibbonRoutingFilter.java:133) ~[spring-cloud-netflix-core-1.1.5.RELEASE.jar:1.1.5.RELEASE]
at org.springframework.cloud.netflix.zuul.filters.route.RibbonRoutingFilter.run(RibbonRoutingFilter.java:79) ~[spring-cloud-netflix-core-1.1.5.RELEASE.jar:1.1.5.RELEASE]
at com.netflix.zuul.ZuulFilter.runFilter(ZuulFilter.java:112) ~[zuul-core-1.1.0.jar:1.1.0]
at com.netflix.zuul.FilterProcessor.processZuulFilter(FilterProcessor.java:197) ~[zuul-core-1.1.0.jar:1.1.0]
at com.netflix.zuul.FilterProcessor.runFilters(FilterProcessor.java:161) ~[zuul-core-1.1.0.jar:1.1.0]
at com.netflix.zuul.FilterProcessor.route(FilterProcessor.java:120) ~[zuul-core-1.1.0.jar:1.1.0]
at com.netflix.zuul.ZuulRunner.route(ZuulRunner.java:96) ~[zuul-core-1.1.0.jar:1.1.0]
at com.netflix.zuul.http.ZuulServlet.route(ZuulServlet.java:116) ~[zuul-core-1.1.0.jar:1.1.0]
at com.netflix.zuul.http.ZuulServlet.service(ZuulServlet.java:81) ~[zuul-core-1.1.0.jar:1.1.0]
at org.springframework.web.servlet.mvc.ServletWrappingController.handleRequestInternal(ServletWrappingController.java:157) [spring-webmvc-4.3.2.RELEASE.jar:4.3.2.RELEASE]
at org.springframework.cloud.netflix.zuul.web.ZuulController.handleRequestInternal(ZuulController.java:43) [spring-cloud-netflix-core-1.1.5.RELEASE.jar:1.1.5.RELEASE]
at org.springframework.web.servlet.mvc.AbstractController.handleRequest(AbstractController.java:174) [spring-webmvc-4.3.2.RELEASE.jar:4.3.2.RELEASE]
at org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handleControllerHandlerAdapter.java:50) [spring-webmvc-4.3.2.RELEASE.jar:4.3.2.RELEASE]
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:963) [spring-webmvc-4.3.2.RELEASE.jar:4.3.2.RELEASE]
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:897) [spring-webmvc-4.3.2.RELEASE.jar:4.3.2.RELEASE]
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970) [spring-webmvc-4.3.2.RELEASE.jar:4.3.2.RELEASE]
at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:861) [spring-webmvc-4.3.2.RELEASE.jar:4.3.2.RELEASE]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:622) [tomcat-embed-core-8.5.4.jar:8.5.4]
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846) [spring-webmvc-4.3.2.RELEASE.jar:4.3.2.RELEASE]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:729) [tomcat-embed-core-8.5.4.jar:8.5.4]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:230) [tomcat-embed-core-8.5.4.jar:8.5.4]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165) [tomcat-embed-core-8.5.4.jar:8.5.4]
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) [tomcat-embed-websocket-8.5.4.jar:8.5.4]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192) [tomcat-embed-core-8.5.4.jar:8.5.4]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165) [tomcat-embed-core-8.5.4.jar:8.5.4]
at org.springframework.boot.web.filter.ApplicationContextHeaderFilter.doFilterInternal(ApplicationContextHeaderFilter.java:55) [spring-boot-1.4.0.RELEASE.jar:1.4.0.RELEASE]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-4.3.2.RELEASE.jar:4.3.2.RELEASE]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.jav[tomcat-embed-core-8.5.4.jar:8.5.4]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165) [tomcat-embed-core-8.5.4.jar:8.5.4]
at org.springframework.boot.actuate.trace.WebRequestTraceFilter.doFilterInternal(WebRequestTraceFilter.java:105) [spring-boot-actuator-1.4.0.RELEASE.jar:1.4.0.RELEASE]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-4.3.2.RELEASE.jar:4.3.2.RELEASE]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192) [tomcat-embed-core-8.5.4.jar:8.5.4]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165) [tomcat-embed-core-8.5.4.jar:8.5.4]
at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99) [spring-web-4.3.2.RELEASE.jar:4.3.2.RELEASE]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-4.3.2.RELEASE.jar:4.3.2.RELEASE]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192) [tomcat-embed-core-8.5.4.jar:8.5.4]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165) [tomcat-embed-core-8.5.4.jar:8.5.4]
at org.springframework.web.filter.HttpPutFormContentFilter.doFilterInternal(HttpPutFormContentFilter.java:87) [spring-web-4.3.2.RELEASE.jar:4.3.2.RELEASE]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-4.3.2.RELEASE.jar:4.3.2.RELEASE]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192) [tomcat-embed-core-8.5.4.jar:8.5.4]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165) [tomcat-embed-core-8.5.4.jar:8.5.4]
at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:77) [spring-web-4.3.2.RELEASE.jar:4.3.2.RELEASE]
at org.springframeworklter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-4.3.2.RELEASE.jar:4.3.2.RELEASE]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192) [tomcat-embed-core-8.5.4.jar:8.5.4]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165) [tomcat-embed-core-8.5.4.jar:8.5.4]
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:197) [spring-web-4.3.2.RELEASE.jar:4.3.2.RELEASE]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-4.3.2.RELEASE.jar:4.3.2.RELEASE]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192) [tomcat-embed-core-8.5.4.jar:8.5.4]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165) [tomcat-embed-core-8.5.4.jar:8.5.4]
at org.springframework.boot.actuate.autoconfigure.MetricsFilter.doFilterInternal(MetricsFilter.java:107) [spring-boot-actuator-1.4.0.RELEASE.jar:1.4.0.RELEASE]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-4.3.2.RELEASE.jar:4.3.2.RELEASE]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192) [tomcat-embed-core-8.5.4.jar:8.5.4]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165) [tomcat-embed-core-8.5.4.jar:8.5.4]
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:198) [tomcat-embed-core-8.5.4.jar:8.5.4]
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:108) [tomcat-embed-core-8.5.4.jar:8.5.4]
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:522) [tomcat-embed-core-8.5.4.jar:8.5.4]
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140) [tomcat-embed-core-8.5.4.jar:8.5.4]
at org.apache.catalina.valves.ErroValve.invoke(ErrorReportValve.java:79) [tomcat-embed-core-8.5.4.jar:8.5.4]
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87) [tomcat-embed-core-8.5.4.jar:8.5.4]
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:349) [tomcat-embed-core-8.5.4.jar:8.5.4]
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:1110) [tomcat-embed-core-8.5.4.jar:8.5.4]
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66) [tomcat-embed-core-8.5.4.jar:8.5.4]
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:785) [tomcat-embed-core-8.5.4.jar:8.5.4]
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1425) [tomcat-embed-core-8.5.4.jar:8.5.4]
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) [tomcat-embed-core-8.5.4.jar:8.5.4]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_60]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_60]
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-embed-core-8.5.4.jar:8.5.4]
at java.lang.Thread.run(Thread.java:745) [na:1.8.0_60]
Caused by: com.netflix.client.ClientException: Load balancer does not have available server for client: book
at com.netflix.loadbalancer.LoadBalancerContext.getServerFromLoadBalancer(LoadBalancerContext.java:468) ~[ribbon-loadbalancer-2.2.0.jar:2.2.0]
at com.netflix.loadbalancer.reactive.LoadBalancerCommand$1.call(LoadBalancerCommand.java:184) ~[ribbon-loadbalancer-2.2.0.jar:2.2.0]
at com.netflix.loadbalancer.reactive.LoadBalancerCommand$1.call(LoadBalancerCommand.java:180) ~[ribbon-loadbalancer-2.2.0.jar:2.2.0]
at rx.Observable.unsafeSubscribe(Observable.java:8460) ~[rxjava-1.1.5.jar:1.1.5]
at rx.internal.operators.OnSubscribeConcatMap.call(OnSubscribeConcatMap.java:94) ~[rxjava-1.1.5.jar:1.1.5]
at rx.internal.operators.OnSubscratMap.call(OnSubscribeConcatMap.java:42) ~[rxjava-1.1.5.jar:1.1.5]
at rx.Observable.unsafeSubscribe(Observable.java:8460) ~[rxjava-1.1.5.jar:1.1.5]
at rx.internal.operators.OperatorRetryWithPredicate$SourceSubscriber$1.call(OperatorRetryWithPredicate.java:131) ~[rxjava-1.1.5.jar:1.1.5]
at rx.internal.schedulers.TrampolineScheduler$InnerCurrentThreadScheduler.enqueue(TrampolineScheduler.java:76) ~[rxjava-1.1.5.jar:1.1.5]
at rx.internal.schedulers.TrampolineScheduler$InnerCurrentThreadScheduler.schedule(TrampolineScheduler.java:55) ~[rxjava-1.1.5.jar:1.1.5]
at rx.internal.operators.OperatorRetryWithPredicate$SourceSubscriber.onNext(OperatorRetryWithPredicate.java:83) ~[rxjava-1.1.5.jar:1.1.5]
at rx.internal.operators.OperatorRetryWithPredicate$SourceSubscriber.onNext(OperatorRetryWithPredicate.java:49) ~[rxjava-1.1.5.jar:1.1.5]
at rx.internal.util.ScalarSynchronousObservable$WeakSingleProducer.request(ScalarSynchronousObservable.java:268) ~[rxjava-1.1.5.jar:1.1.5]
at rx.Subscriber.setProducer(Subscriber.java:209) ~[rxjava-1.1.5.jar:1.1.5]
at rx.internal.util.ScalarSynchronousObservable$1.call(ScalarSynchronousObservable.java:79) ~[rxjava-1.1.5.jar:1.1.5]
at rx.internal.util.ScalarSynchronousObservable$1.call(ScalarSynchronousObservable.java:75) ~[rxjava-1.1.5.jar:1.1.5]
at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:50) ~[rxjava-1.1.5.jar:1.1.5]
at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30) ~[rxjava-1.1.5.jar:1.1.5]
at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:50) ~[rxjava-1.1.5.jar:1.1.5]
at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30) ~[rxjava-1.1.5.jar:1.1.5]
at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:50) ~[rxjava-1.1.5.jar:1.1.5]
at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30) ~[rxjava-1.1.5.jar:1.1.5]
at rx.Observable.subscribe(Observable.java:8553) ~[rxjava-1.1.5.jar:1.1.5]
at rx.Observable.subscribe(Observable.java:8520) ~[rxjava-1.1.5.jar:1.1.5]
aservables.BlockingObservable.blockForSingle(BlockingObservable.java:433) ~[rxjava-1.1.5.jar:1.1.5]
at rx.observables.BlockingObservable.single(BlockingObservable.java:332) ~[rxjava-1.1.5.jar:1.1.5]
at com.netflix.client.AbstractLoadBalancerAwareClient.executeWithLoadBalancer(AbstractLoadBalancerAwareClient.java:102) ~[ribbon-loadbalancer-2.2.0.jar:2.2.0]
at com.netflix.client.AbstractLoadBalancerAwareClient.executeWithLoadBalancer(AbstractLoadBalancerAwareClient.java:81) ~[ribbon-loadbalancer-2.2.0.jar:2.2.0]
at org.springframework.cloud.netflix.zuul.filters.route.RestClientRibbonCommand.forward(RestClientRibbonCommand.java:135) ~[spring-cloud-netflix-core-1.1.5.RELEASE.jar:1.1.5.RELEASE]
at org.springframework.cloud.netflix.zuul.filters.route.RestClientRibbonCommand.run(RestClientRibbonCommand.java:106) ~[spring-cloud-netflix-core-1.1.5.RELEASE.jar:1.1.5.RELEASE]
at org.springframework.cloud.netflix.zuul.filters.route.RestClientRibbonCommand.run(RestClientRibbonCommand.java:50) ~[spring-cloud-netflix-core-1.1.5.RELEASE.jar:1.1.5.RELEASE]
at com.netflix.hystrix.HystrixCommand$1.call(HystrixCommand.java:293) ~[hystrix-core-1.5.3.jar:1.5.3]
at com.netflix.hystrix.HystrixCommand$1.call(HystrixCommand.java:289) ~[hystrix-core-1.5.3.jar:1.5.3]
at rx.internal.operators.OnSubscribeDefer.call(OnSubscribeDefer.java:46) ~[rxjava-1.1.5.jar:1.1.5]
at rx.internal.operators.OnSubscribeDefer.call(OnSubscribeDefer.java:35) ~[rxjava-1.1.5.jar:1.1.5]
at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:50) ~[rxjava-1.1.5.jar:1.1.5]
at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30) ~[rxjava-1.1.5.jar:1.1.5]
at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:50) ~[rxjava-1.1.5.jar:1.1.5]
at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30) ~[rxjava-1.1.5.jar:1.1.5]
at rx.Observable.unsafeSubscribe(Observable.java:8460) ~[rxjava-1.1.5.jar:1.1.5]
at rx.internal.operators.OnSubscribeDefer.call(OnSubscribeDefer.java:51) ~[rxjava-1.1.5.jar:1.1.5]
internal.operators.OnSubscribeDefer.call(OnSubscribeDefer.java:35) ~[rxjava-1.1.5.jar:1.1.5]
at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:50) ~[rxjava-1.1.5.jar:1.1.5]
at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30) ~[rxjava-1.1.5.jar:1.1.5]
at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:50) ~[rxjava-1.1.5.jar:1.1.5]
at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30) ~[rxjava-1.1.5.jar:1.1.5]
at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:50) ~[rxjava-1.1.5.jar:1.1.5]
at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30) ~[rxjava-1.1.5.jar:1.1.5]
at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:50) ~[rxjava-1.1.5.jar:1.1.5]
at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30) ~[rxjava-1.1.5.jar:1.1.5]
at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:50) ~[rxjava-1.1.5.jar:1.1.5]
at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30) ~[rxjava-1.1.5.jar:1.1.5]
at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:50) ~[rxjava-1.1.5.jar:1.1.5]
at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30) ~[rxjava-1.1.5.jar:1.1.5]
at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:50) ~[rxjava-1.1.5.jar:1.1.5]
at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30) ~[rxjava-1.1.5.jar:1.1.5]
at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:50) ~[rxjava-1.1.5.jar:1.1.5]
at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30) ~[rxjava-1.1.5.jar:1.1.5]
at rx.Observable.unsafeSubscribe(Observable.java:8460) ~[rxjava-1.1.5.jar:1.1.5]
at rx.internal.operators.OnSubscribeDefer.call(OnSubscribeDefer.java:51) ~[rxjava-1.1.5.jar:1.1.5]
at rx.internal.operators.OnSubscribeDefer.call(OnSubscribeDefer.java:35) ~[rxjava-1.1.5.jar:1.1.5]
at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:50) ~[rxjava-1.1.5.jar:1.1.5]
internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30) ~[rxjava-1.1.5.jar:1.1.5]
at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:50) ~[rxjava-1.1.5.jar:1.1.5]
at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30) ~[rxjava-1.1.5.jar:1.1.5]
at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:50) ~[rxjava-1.1.5.jar:1.1.5]
at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30) ~[rxjava-1.1.5.jar:1.1.5]
at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:50) ~[rxjava-1.1.5.jar:1.1.5]
at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30) ~[rxjava-1.1.5.jar:1.1.5]
at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:50) ~[rxjava-1.1.5.jar:1.1.5]
at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30) ~[rxjava-1.1.5.jar:1.1.5]
at rx.Observable.subscribe(Observable.java:8553) ~[rxjava-1.1.5.jar:1.1.5]
at rx.Observable.subscribe(Observable.java:8520) ~[rxjava-1.1.5.jar:1.1.5]
at rx.internal.operators.BlockingOperatorToFuture.toFuture(BlockingOperatorToFuture.java:57) ~[rxjava-1.1.5.jar:1.1.5]
at rx.observables.BlockingObservable.toFuture(BlockingObservable.java:401) ~[rxjava-1.1.5.jar:1.1.5]
at com.netflix.hystrix.HystrixCommand.queue(HystrixCommand.java:373) ~[hystrix-core-1.5.3.jar:1.5.3]
at com.netflix.hystrix.HystrixCommand.execute(HystrixCommand.java:329) ~[hystrix-core-1.5.3.jar:1.5.3]
at org.springframework.cloud.netflix.zuul.filters.route.RibbonRoutingFilter.forward(RibbonRoutingFilter.java:127) ~[spring-cloud-netflix-core-1.1.5.RELEASE.jar:1.1.5.RELEASE]
... 68 common frames omitted

Related

The Swift pod `ExpoModulesCore` depends upon `React-RCTAppDelegate`

What a complete nightmare it is updating react-native libraries with expo. I tried updating the codebase libraries to help the my app become up to date. However, as expected, its not as easy as running a npm update --force :D. I have been going through errors for the last few days; today is day three of fixing errors until I get a successful build. Todays error is really stumping me. Anyone now how to resolve the following?:
Error
The Swift pod `ExpoModulesCore` depends upon `React-RCTAppDelegate`, which does not define modules.
I tried adding pod 'ExpoModulesCore',:modular_headers => true to my podfile but this resulted in the following error:
[!] Unable to find a specification for `ExpoModulesCore`
...Even though I have this in my package.json file which I'll add below. The name is different is in package.json it has hypens between the words. However, if I change the name to that I get the same error just with the corresponding name.
so I tried a global modular_headers but then got a name space conflict with google error. I then tried adding pod 'React-RCTAppDelegate', :modular_headers => true but I get the following error
[!] There are multiple dependencies with different sources for `React-RCTAppDelegate` in `Podfile`:
- React-RCTAppDelegate
- React-RCTAppDelegate (from `../node_modules/react-native/Libraries/AppDelegate`)
I am completely lost what to do any more, this must be error 49/xxx. I will provide my old package.json and my new one along with my podfile and delegate.m and h files. Any help is appreciated.
I downgraded expo because it helped me resolve another error I was getting related to no modules defined in reatdelegate
New Package.json
{
"scripts": {
"start": "react-native start",
"android": "react-native run-android",
"ios": "react-native run-ios",
"web": "expo start --web",
"eject": "expo eject",
"build:ios": "react-native bundle — entry-file index.js — platform ios — dev false — bundle-output ios/main.jsbundle — assets-dest ios"
},
"dependencies": {
"#expo/vector-icons": "^13.0.0",
"#gregfrench/react-native-wheel-picker": "^1.2.16",
"#react-native-community/datetimepicker": "^6.7.3",
"#react-native-community/masked-view": "0.1.10",
"#react-native-community/push-notification-ios": "^1.10.1",
"#react-native-firebase/app": "^17.0.0",
"#react-native-firebase/messaging": "^17.0.0",
"#react-native-picker/picker": "^2.4.8",
"#reduxjs/toolkit": "^1.9.2",
"#sentry/react-native": "^4.14.0",
"axios": "^1.3.2",
"buffer": "^6.0.3",
"expo": "47.0.9",
"expo-barcode-scanner": "~12.1.0",
"expo-camera": "~13.1.0",
"expo-device": "^5.0.0",
"expo-image-manipulator": "~11.0.0",
"expo-image-picker": "~14.1.0",
"expo-media-library": "~15.0.0",
"expo-modules-core": "1.1.1",
"expo-notifications": "^0.17.0",
"expo-permissions": "~14.0.0",
"expo-secure-store": "~12.0.0",
"expo-splash-screen": "^0.17.5",
"expo-sqlite": "~11.0.0",
"expo-status-bar": "~1.4.2",
"expo-updates": "^0.15.6",
"formik": "^2.2.9",
"lodash": "^4.17.21",
"moment": "^2.29.4",
"react": "18.2.0",
"react-axios": "^2.0.6",
"react-dom": "18.2.0",
"react-native": "^0.71.2",
"react-native-appearance": "^0.3.4",
"react-native-background-actions": "^3.0.0",
"react-native-background-fetch": "^4.1.8",
"react-native-ble-plx": "^2.0.3",
"react-native-calendars": "^1.1293.0",
"react-native-device-info": "^10.3.0",
"react-native-elements": "^3.4.3",
"react-native-fast-image": "^8.6.3",
"react-native-gesture-handler": "~2.9.0",
"react-native-image-slider-box": "^2.0.7",
"react-native-image-zoom-viewer": "^3.0.1",
"react-native-keyboard-aware-scrollview": "^2.1.0",
"react-native-permissions": "^3.6.1",
"react-native-push-notification": "^8.1.1",
"react-native-reanimated": "^2.14.4",
"react-native-safe-area-context": "4.5.0",
"react-native-screens": "~3.19.0",
"react-native-snap-carousel": "^3.9.1",
"react-native-switch": "^2.0.0",
"react-native-unimodules": "^0.14.10",
"react-native-web": "^0.18.12",
"react-native-webview": "^11.26.1",
"react-native-wheel-picker-android": "^2.0.6",
"react-navigation": "^4.4.3",
"react-navigation-stack": "^2.9.0",
"react-redux": "^8.0.5",
"rn-fetch-blob": "^0.12.0",
"toggle-switch-react-native": "^3.3.0"
},
"devDependencies": {
"#babel/core": "~7.20.12",
"babel-jest": "~29.4.1",
"jest": "^29.4.1",
"prettier": "^2.8.3",
"react-test-renderer": "~18.2.0",
"typescript": "~4.9.5"
},
"private": true,
"name": "pdi-app-v2",
"version": "1.0.0"
}
Old Package.json
{
"scripts": {
"start": "react-native start",
"android": "react-native run-android",
"ios": "react-native run-ios",
"web": "expo start --web",
"eject": "expo eject",
"build:ios": "react-native bundle — entry-file index.js — platform ios — dev false — bundle-output ios/main.jsbundle — assets-dest ios"
},
"dependencies": {
"#expo/vector-icons": "^10.0.0",
"#gregfrench/react-native-wheel-picker": "^1.2.14",
"#react-native-community/datetimepicker": "^3.0.9",
"#react-native-community/masked-view": "0.1.10",
"#react-native-community/push-notification-ios": "^1.7.1",
"#react-native-firebase/app": "^8.4.7",
"#react-native-firebase/messaging": "^7.9.1",
"#react-native-picker/picker": "^1.16.1",
"#reduxjs/toolkit": "^1.4.0",
"#sentry/react-native": "^3.2.10",
"axios": "^0.15.0",
"buffer": "^6.0.2",
"expo": "~39.0.2",
"expo-barcode-scanner": "~9.0.0",
"expo-camera": "~9.0.0",
"expo-device": "~2.3.0",
"expo-image-manipulator": "~8.3.0",
"expo-image-picker": "~9.1.1",
"expo-media-library": "~9.2.1",
"expo-notifications": "0.8.2",
"expo-permissions": "~9.3.0",
"expo-secure-store": "~9.2.0",
"expo-splash-screen": "~0.6.1",
"expo-sqlite": "~8.4.0",
"expo-status-bar": "~1.0.2",
"expo-updates": "~0.3.3",
"formik": "^2.2.9",
"lodash": "^4.17.21",
"moment": "^2.29.0",
"react": "16.13.1",
"react-axios": "2.0.3",
"react-dom": "16.13.1",
"react-native": "0.63.4",
"react-native-appearance": "^0.3.4",
"react-native-background-actions": "^2.6.1",
"react-native-background-fetch": "^4.0.2",
"react-native-ble-plx": "^2.0.3",
"react-native-calendars": "^1.403.0",
"react-native-device-info": "^8.1.3",
"react-native-elements": "^2.3.2",
"react-native-fast-image": "^8.3.4",
"react-native-gesture-handler": "~1.7.0",
"react-native-image-slider-box": "^1.0.12",
"react-native-image-zoom-viewer": "^3.0.1",
"react-native-keyboard-aware-scrollview": "^2.1.0",
"react-native-permissions": "^3.0.5",
"react-native-push-notification": "^6.1.3",
"react-native-reanimated": "~1.13.0",
"react-native-safe-area-context": "3.1.4",
"react-native-screens": "~2.10.1",
"react-native-snap-carousel": "^3.9.1",
"react-native-switch": "^2.0.0",
"react-native-unimodules": "~0.11.0",
"react-native-web": "0.14.0",
"react-native-webview": "^10.8.2",
"react-native-wheel-picker-android": "^2.0.6",
"react-navigation": "^4.4.3",
"react-navigation-stack": "^2.9.0",
"react-redux": "^7.2.2",
"rn-fetch-blob": "^0.12.0",
"toggle-switch-react-native": "^2.3.0"
},
"devDependencies": {
"#babel/core": "~7.9.0",
"babel-jest": "~25.2.6",
"jest": "~25.2.6",
"prettier": "^2.5.1",
"react-test-renderer": "~16.13.1",
"typescript": "~3.9.2"
},
"private": true,
"name": "pdi-app-v2",
"version": "1.0.0"
}
#Podfile
require File.join(File.dirname(`node --print "require.resolve('expo/package.json')"`), "scripts/autolinking")
require File.join(File.dirname(`node --print "require.resolve('react-native/package.json')"`), "scripts/react_native_pods")
require File.join(File.dirname(`node --print "require.resolve('#react-native-community/cli-platform-ios/package.json')"`), "native_modules")
pod 'Firebase', :modular_headers => true
pod 'FirebaseCore', :modular_headers => true
pod 'GoogleUtilities', :modular_headers => true
pod 'React-RCTAppDelegate', :modular_headers => true
$RNFirebaseAsStaticFramework = true
require 'json'
podfile_properties = JSON.parse(File.read(File.join(__dir__, 'Podfile.properties.json'))) rescue {}
platform :ios, podfile_properties['ios.deploymentTarget'] || '13.0'
install! 'cocoapods',
:deterministic_uuids => false
target 'pdimobile' do
use_expo_modules!
config = use_native_modules!
use_frameworks! :linkage => podfile_properties['ios.useFrameworks'].to_sym if podfile_properties['ios.useFrameworks']
# Flags change depending on the env values.
flags = get_default_flags()
use_flipper! # should match the version of your Flipper client app
use_react_native!(
:path => config[:reactNativePath],
:hermes_enabled => podfile_properties['expo.jsEngine'] == 'hermes',
:fabric_enabled => flags[:fabric_enabled],
# An absolute path to your application root.
:app_path => "#{Pod::Config.instance.installation_root}/..",
)
post_install do |installer|
flipper_post_install(installer)
react_native_post_install(
installer,
# Set `mac_catalyst_enabled` to `true` in order to apply patches
# necessary for Mac Catalyst builds
:mac_catalyst_enabled => false
)
__apply_Xcode_12_5_M1_post_install_workaround(installer)
# This is necessary for Xcode 14, because it signs resource bundles by default
# when building for devices.
installer.target_installation_results.pod_target_installation_results
.each do |pod_name, target_installation_result|
target_installation_result.resource_bundle_targets.each do |resource_bundle_target|
resource_bundle_target.build_configurations.each do |config|
config.build_settings['CODE_SIGNING_ALLOWED'] = 'NO'
end
end
end
end
permissions_path = '../node_modules/react-native-permissions/ios'
pod 'Permission-BluetoothPeripheral', :path => "#{permissions_path}/BluetoothPeripheral"
pod 'Permission-Camera', :path => "#{permissions_path}/Camera"
pod 'Permission-Notifications', :path => "#{permissions_path}/Notifications"
pod 'Permission-PhotoLibrary', :path => "#{permissions_path}/PhotoLibrary"
post_integrate do |installer|
begin
expo_patch_react_imports!(installer)
rescue => e
Pod::UI.warn e
end
begin
expo_patch_react_imports!(installer)
rescue => e
Pod::UI.warn e
end
end
end
#AppDelegate.h
#import <UserNotifications/UNUserNotificationCenter.h>
#import <Expo/Expo.h>
#import <Foundation/Foundation.h>
#import <EXUpdates/EXUpdatesAppController.h>
#import <React/RCTBridgeDelegate.h>
#import <UIKit/UIKit.h>
#import <UMCore/UMAppDelegateWrapper.h>
#interface AppDelegate : UMAppDelegateWrapper <RCTBridgeDelegate, EXUpdatesAppControllerDelegate, UNUserNotificationCenterDelegate>
#end
AppDelegate.m
#import <Firebase.h>
#import "AppDelegate.h"
#import <UserNotifications/UserNotifications.h>
#import <RNCPushNotificationIOS.h>
#import <React/RCTBridge.h>
#import <React/RCTBundleURLProvider.h>
#import <React/RCTRootView.h>
#import <TSBackgroundFetch/TSBackgroundFetch.h>
#if RCT_DEV
#import <React/RCTDevLoadingView.h>
#endif
#import <UMCore/UMModuleRegistry.h>
#import <UMReactNativeAdapter/UMNativeModulesProxy.h>
#import <UMReactNativeAdapter/UMModuleRegistryAdapter.h>
#import <EXSplashScreen/EXSplashScreenService.h>
#import <UMCore/UMModuleRegistryProvider.h>
#ifdef FB_SONARKIT_ENABLED
#import <FlipperKit/FlipperClient.h>
#import <FlipperKitLayoutPlugin/FlipperKitLayoutPlugin.h>
#import <FlipperKitUserDefaultsPlugin/FKUserDefaultsPlugin.h>
#import <FlipperKitNetworkPlugin/FlipperKitNetworkPlugin.h>
#import <SKIOSNetworkPlugin/SKIOSNetworkAdapter.h>
#import <FlipperKitReactPlugin/FlipperKitReactPlugin.h>
static void InitializeFlipper(UIApplication *application) {
FlipperClient *client = [FlipperClient sharedClient];
SKDescriptorMapper *layoutDescriptorMapper = [[SKDescriptorMapper alloc] initWithDefaults];
[client addPlugin:[[FlipperKitLayoutPlugin alloc] initWithRootNode:application withDescriptorMapper:layoutDescriptorMapper]];
[client addPlugin:[[FKUserDefaultsPlugin alloc] initWithSuiteName:nil]];
[client addPlugin:[FlipperKitReactPlugin new]];
[client addPlugin:[[FlipperKitNetworkPlugin alloc] initWithNetworkAdapter:[SKIOSNetworkAdapter new]]];
[client start];
}
#endif
#interface AppDelegate () <RCTBridgeDelegate>
#property (nonatomic, strong) UMModuleRegistryAdapter *moduleRegistryAdapter;
#property (nonatomic, strong) NSDictionary *launchOptions;
#end
#implementation AppDelegate
// Required for the register event.
- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken
{
[RNCPushNotificationIOS didRegisterForRemoteNotificationsWithDeviceToken:deviceToken];
}
// Required for the notification event. You must call the completion handler after handling the remote notification.
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo
fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler
{
[RNCPushNotificationIOS didReceiveRemoteNotification:userInfo fetchCompletionHandler:completionHandler];
}
// Required for the registrationError event.
- (void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error
{
[RNCPushNotificationIOS didFailToRegisterForRemoteNotificationsWithError:error];
}
// Required for localNotification event
- (void)userNotificationCenter:(UNUserNotificationCenter *)center
didReceiveNotificationResponse:(UNNotificationResponse *)response
withCompletionHandler:(void (^)(void))completionHandler
{
[RNCPushNotificationIOS didReceiveNotificationResponse:response];
}
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
#ifdef FB_SONARKIT_ENABLED
InitializeFlipper(application);
#endif
self.moduleRegistryAdapter = [[UMModuleRegistryAdapter alloc] initWithModuleRegistryProvider:[[UMModuleRegistryProvider alloc] init]];
self.launchOptions = launchOptions;
self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
#ifdef DEBUG
[self initializeReactNativeApp];
#else
EXUpdatesAppController *controller = [EXUpdatesAppController sharedInstance];
controller.delegate = self;
[controller startAndShowLaunchScreen:self.window];
#endif
[super application:application didFinishLaunchingWithOptions:launchOptions];
if([FIRApp defaultApp] == nil) {
[FIRApp configure];
}
NSURL *jsCodeLocation;
jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:#"index"];
RCTBridge *bridge = [[RCTBridge alloc] initWithBundleURL:jsCodeLocation
moduleProvider:nil
launchOptions:launchOptions];
#if RCT_DEV
[bridge moduleForClass:[RCTDevLoadingView class]];
#endif
RCTRootView *rootView = [self.reactDelegate createRootViewWithBridge:bridge
moduleName:#"Test"
initialProperties:nil];
UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter];
center.delegate = self;
[[TSBackgroundFetch sharedInstance] didFinishLaunching];
return YES;
}
//Called when a notification is delivered to a foreground app.
-(void)userNotificationCenter:(UNUserNotificationCenter *)center willPresentNotification:(UNNotification *)notification withCompletionHandler:(void (^)(UNNotificationPresentationOptions options))completionHandler
{
if (#available(iOS 14.0, *)) {
completionHandler(UNNotificationPresentationOptionSound | UNNotificationPresentationOptionBanner | UNNotificationPresentationOptionBadge);
} else {
// Fallback on earlier versions
completionHandler(UNNotificationPresentationOptionSound | UNNotificationPresentationOptionAlert | UNNotificationPresentationOptionBadge);
}
}
- (RCTBridge *)initializeReactNativeApp
{
RCTBridge *bridge = [self.reactDelegate createBridgeWithDelegate:self launchOptions:self.launchOptions];
RCTRootView *rootView = [self.reactDelegate createRootViewWithBridge:bridge moduleName:#"main" initialProperties:nil];
rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1];
UIViewController *rootViewController = [self.reactDelegate createRootViewController];
rootViewController.view = rootView;
self.window.rootViewController = rootViewController;
[self.window makeKeyAndVisible];
return bridge;
}
- (NSArray<id<RCTBridgeModule>> *)extraModulesForBridge:(RCTBridge *)bridge
{
NSArray<id<RCTBridgeModule>> *extraModules = [_moduleRegistryAdapter extraModulesForBridge:bridge];
// If you'd like to export some custom RCTBridgeModules that are not Expo modules, add them here!
return extraModules;
}
- (NSURL *)sourceURLForBridge:(RCTBridge *)bridge {
#ifdef DEBUG
return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:#"index"];
#else
return [[EXUpdatesAppController sharedInstance] launchAssetUrl];
#endif
}
- (void)appController:(EXUpdatesAppController *)appController didStartWithSuccess:(BOOL)success {
appController.bridge = [self initializeReactNativeApp];
EXSplashScreenService *splashScreenService = (EXSplashScreenService *)[UMModuleRegistryProvider getSingletonModuleForClass:[EXSplashScreenService class]];
[splashScreenService showSplashScreenFor:self.window.rootViewController];
}
#end

Error when adding firebase to React Native iOS app

I am having this error when running React-Native iOS App after adding Firebase and the googleserviceinfo.plist file. I have followed the instructions and I am Getting this error:
2022-10-04 23:35:59.711 xcodebuild[38171:508367] [MT] IDEFileReferenceDebug: [Load] <IDESwiftPackageCore.IDESwiftPackageSpecialFolderFileReference, 0x146d065c0: name:Docs.docc path:group:Docs.docc> Failed to load container at path: /Users/suvin/Library/Developer/Xcode/DerivedData/BoundaryTestApp-ekpfrimpksdanhevovuosfavhjwg/SourcePackages/checkouts/swift-protobuf/Sources/protoc-gen-swift/Docs.docc, Error: Error Domain=com.apple.dt.IDEContainerErrorDomain Code=6 "Cannot open "Docs.docc" as a "Swift Package Folder" because it is already open as a "Folder"." UserInfo={NSLocalizedDescription=Cannot open "Docs.docc" as a "Swift Package Folder" because it is already open as a "Folder".}
** BUILD FAILED **
The following build commands failed:
CompileC /Users/suvin/Library/Developer/Xcode/DerivedData/BoundaryTestApp-ekpfrimpksdanhevovuosfavhjwg/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/React-logger.build/Objects-normal/arm64/react_native_log.o /Users/suvin/Documents/GitHub/react-native-geofence-example-master/node_modules/react-native/ReactCommon/logger/react_native_log.cpp normal arm64 c++ com.apple.compilers.llvm.clang.1_0.compiler (in target 'React-logger' from project 'Pods')
(1 failure)
This is my AppDelegate.m file
#import <UserNotifications/UserNotifications.h>
#import <RNCPushNotificationIOS.h>
#import "AppDelegate.h"
#import UIKit;
#import FirebaseCore;
#import <React/RCTBridge.h>
#import <React/RCTBundleURLProvider.h>
#import <React/RCTRootView.h>
#ifdef FB_SONARKIT_ENABLED
#import <FlipperKit/FlipperClient.h>
#import <FlipperKitLayoutPlugin/FlipperKitLayoutPlugin.h>
#import <FlipperKitUserDefaultsPlugin/FKUserDefaultsPlugin.h>
#import <FlipperKitNetworkPlugin/FlipperKitNetworkPlugin.h>
#import <SKIOSNetworkPlugin/SKIOSNetworkAdapter.h>
#import <FlipperKitReactPlugin/FlipperKitReactPlugin.h>
static void InitializeFlipper(UIApplication *application) {
FlipperClient *client = [FlipperClient sharedClient];
SKDescriptorMapper *layoutDescriptorMapper = [[SKDescriptorMapper alloc] initWithDefaults];
[client addPlugin:[[FlipperKitLayoutPlugin alloc] initWithRootNode:application withDescriptorMapper:layoutDescriptorMapper]];
[client addPlugin:[[FKUserDefaultsPlugin alloc] initWithSuiteName:nil]];
[client addPlugin:[FlipperKitReactPlugin new]];
[client addPlugin:[[FlipperKitNetworkPlugin alloc] initWithNetworkAdapter:[SKIOSNetworkAdapter new]]];
[client start];
}
#endif
#implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
[FIRApp configure];
return YES;
#ifdef FB_SONARKIT_ENABLED
InitializeFlipper(application);
#endif
RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions];
RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge
moduleName:#"BoundaryTestApp"
initialProperties:nil];
if (#available(iOS 13.0, *)) {
rootView.backgroundColor = [UIColor systemBackgroundColor];
} else {
rootView.backgroundColor = [UIColor whiteColor];
}
self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
UIViewController *rootViewController = [UIViewController new];
rootViewController.view = rootView;
self.window.rootViewController = rootViewController;
[self.window makeKeyAndVisible];
// Define UNUserNotificationCenter
UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter];
center.delegate = self;
return YES;
}
- (NSURL *)sourceURLForBridge:(RCTBridge *)bridge
{
#if DEBUG
return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:#"index" fallbackResource:nil];
#else
return [[NSBundle mainBundle] URLForResource:#"main" withExtension:#"jsbundle"];
#endif
}
//Called when a notification is delivered to a foreground app.
-(void)userNotificationCenter:(UNUserNotificationCenter *)center willPresentNotification:(UNNotification *)notification withCompletionHandler:(void (^)(UNNotificationPresentationOptions options))completionHandler
{
completionHandler(UNNotificationPresentationOptionSound | UNNotificationPresentationOptionAlert | UNNotificationPresentationOptionBadge);
}
// Required for the register event.
- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken
{
[RNCPushNotificationIOS didRegisterForRemoteNotificationsWithDeviceToken:deviceToken];
}
// Required for the notification event. You must call the completion handler after handling the remote notification.
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo
fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler
{
[RNCPushNotificationIOS didReceiveRemoteNotification:userInfo fetchCompletionHandler:completionHandler];
}
// Required for the registrationError event.
- (void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error
{
[RNCPushNotificationIOS didFailToRegisterForRemoteNotificationsWithError:error];
}
// Required for localNotification event
- (void)userNotificationCenter:(UNUserNotificationCenter *)center
didReceiveNotificationResponse:(UNNotificationResponse *)response
withCompletionHandler:(void (^)(void))completionHandler
{
[RNCPushNotificationIOS didReceiveNotificationResponse:response];
}
#end
This is my package.json
{
"name": "BoundaryTestApp",
"version": "0.0.1",
"private": true,
"scripts": {
"android": "react-native run-android",
"ios": "react-native run-ios",
"start": "react-native start",
"test": "jest",
"lint": "eslint ."
},
"dependencies": {
"#react-native-community/push-notification-ios": "^1.10.1",
"#react-native-firebase/app": "^15.7.0",
"#react-native-picker/picker": "^2.4.6",
"#react-native/normalize-color": "^2.0.0",
"#react-navigation/bottom-tabs": "^6.4.0",
"#react-navigation/native": "^6.0.13",
"#react-navigation/native-stack": "^6.9.0",
"deprecated-react-native-prop-types": "^2.3.0",
"react": "17.0.2",
"react-native": "0.66.1",
"react-native-boundary": "github:ridvanaltun/react-native-boundary#b4d143406b41e866754b5a5fd0275bbd42949ab8",
"react-native-config": "^1.4.5",
"react-native-elements": "^3.4.2",
"react-native-flash-message": "^0.3.1",
"react-native-get-location": "^2.2.1",
"react-native-image-picker": "^4.10.0",
"react-native-linear-gradient": "^2.6.2",
"react-native-maps": "0.30.1",
"react-native-permissions": "^3.1.0",
"react-native-picker": "^4.3.7",
"react-native-picker-select": "^8.0.4",
"react-native-push-notification": "^8.1.1",
"react-native-radio-buttons-group": "^2.2.11",
"react-native-safe-area-context": "^4.4.1",
"react-native-screen": "^1.0.1",
"react-native-screens": "^3.17.0",
"react-native-simple-radio-button": "^2.7.4",
"react-native-svg": "^13.2.0",
"react-native-svg-transformer": "^1.0.0",
"react-native-vector-icons": "^9.2.0"
},
"devDependencies": {
"#babel/core": "^7.15.8",
"#babel/runtime": "^7.15.4",
"#react-native-community/eslint-config": "^3.0.1",
"babel-jest": "^27.3.1",
"eslint": "^8.1.0",
"jest": "^27.3.1",
"metro-react-native-babel-preset": "^0.66.2",
"react-test-renderer": "17.0.2"
},
"jest": {
"preset": "react-native"
}
}
This is my Podfile
require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/#react-native-community/cli-platform-ios/native_modules'
platform :ios, '11.0'
target 'BoundaryTestApp' do
config = use_native_modules!
use_modular_headers!
use_react_native!(
:path => config[:reactNativePath],
# to enable hermes on iOS, change `false` to `true` and then install pods
:hermes_enabled => false
)
target 'BoundaryTestAppTests' do
inherit! :complete
# Pods for testing
end
permissions_path = '../node_modules/react-native-permissions/ios'
pod 'Permission-LocationAlways', :path => "#{permissions_path}/LocationAlways"
# Enables Flipper.
#
# Note that if you have use_frameworks! enabled, Flipper will not work and
# you should disable the next line.
use_flipper!()
post_install do |installer|
react_native_post_install(installer)
__apply_Xcode_12_5_M1_post_install_workaround(installer)
end
end

IOS application is not starting - i can only see the splash screen then it fade out without starting

I have a React-Native project.
This project begun with Expo then it has been ejected switched to react-native.
Last week i have updated an expo library that was available in it, i begins to get errors and i was not able to start the project anymore.
What i have made, i have removed all expo libraries used, and i have succeeded to start it up on android...
But on IOS, it's running without debug problems, but when i start the app it shows the splash screen then it fadeout without starting the first app screen.
It seems like onSplashscreen.hide, its not opening the app first screen
this is the package.json file (and the changes i have made (git))
This is the appDelegate.m
{
"name": "~~~~~~",
"version": "2.0.0",
"private": true,
"main": "./index.js",
"scripts": {
"start": "react-native start",
"android": "react-native run-android",
"ios": "react-native run-ios",
"web": "expo start --web",
"eject": "expo eject",
"open:android": "open -a /Applications/Android\\ Studio.app ./android",
"compile": "tsc --noEmit",
"debug": "open 'rndebugger://set-debugger-loc?host=localhost&port=8081'"
},
"dependencies": {
"#babel/plugin-proposal-decorators": "^7.17.2",
"#eva-design/eva": "^2.0.0",
"#react-native-clipboard/clipboard": "^1.9.0",
"#react-native-community/async-storage": "^1.12.1",
"#react-native-community/cameraroll": "^4.1.2",
"#react-native-community/datetimepicker": "^3.2.0",
"#react-native-community/masked-view": "0.1.10",
"#react-native-community/netinfo": "^6.0.0",
"#react-native-picker/picker": "^1.9.12",
"#react-navigation/bottom-tabs": "^5.10.0",
"#react-navigation/native": "^5.8.0",
"#react-navigation/stack": "^5.10.0",
"#ui-kitten/components": "^5.0.0",
"add": "^2.0.6",
"axios": "^0.21.0",
"babel-preset-expo": "^9.0.2",
"class-transformer": "^0.4.0",
"class-validator": "~0.11.1",
"color": "^3.1.3",
"expo-app-loading": "^1.3.0",
"expo-modules-core": "^0.6.5",
"formik": "^2.2.1",
"lodash": "^4.17.20",
"lottie-ios": "3.1.8",
"lottie-react-native": "3.5.0",
"mobx": "5.15.7",
"mobx-react": "6.3.1",
"mobx-state-tree": "^3.17.2",
"moment": "^2.29.1",
"native-base": "^2.15.2",
"react": "^17.0.2",
"react-dom": "16.13.1",
"react-native": "~0.63.4",
"react-native-change-icon": "^3.0.0",
"react-native-collapsible": "1.5.3",
"react-native-elements": "^3.3.1",
"react-native-gesture-handler": "~1.8.0",
"react-native-image-zoom-viewer": "^3.0.1",
"react-native-keyboard-aware-scroll-view": "^0.9.3",
"react-native-markdown-renderer": "^3.2.8",
"react-native-modal": "^11.10.0",
"react-native-modal-datetime-picker": "^9.2.0",
"react-native-onesignal": "~4.0.3",
"react-native-picker-select": "^8.0.4",
"react-native-reanimated": "~1.13.0",
"react-native-safe-area-context": "3.1.9",
"react-native-screens": "~2.15.2",
"react-native-signature-capture": "^0.4.11",
"react-native-skeleton-placeholder": "^3.0.4",
"react-native-smooth-pincode-input": "^1.0.9",
"react-native-splash-screen": "^3.3.0",
"react-native-step-indicator": "^1.0.3",
"react-native-svg": "^12.1.0",
"react-native-svg-transformer": "^0.14.3",
"react-native-tiny-toast": "^1.0.7",
"react-native-web": "~0.13.12",
"react-native-webview": "10.7.0",
"react-redux": "^7.2.3",
"reanimated-bottom-sheet": "^1.0.0-alpha.22",
"redux": "^4.0.5",
"redux-devtools-extension": "^2.13.9",
"redux-thunk": "^2.3.0",
"reflect-metadata": "^0.1.13",
"rxjs": "^6.6.3",
"uuid": "^8.3.2",
"yarn": "^1.22.10",
"yup": "^0.32.9"
},
"devDependencies": {
"#babel/core": "~7.9.0",
"#types/color": "^3.0.1",
"#types/lodash": "^4.14.162",
"#types/react": "~16.9.35",
"#types/react-dom": "~16.9.8",
"#types/react-native": "~0.63.2",
"#types/react-native-signature-capture": "^0.4.1",
"#types/react-redux": "^7.1.16",
"#types/remote-redux-devtools": "^0.5.4",
"#types/yup": "^0.29.8",
"#typescript-eslint/eslint-plugin": "^4.6.0",
"#typescript-eslint/parser": "^4.6.0",
"babel-jest": "~25.2.6",
"eslint": "^7.12.1",
"eslint-config-prettier": "^6.15.0",
"eslint-plugin-prettier": "^3.1.4",
"eslint-plugin-react": "^7.21.5",
"eslint-plugin-react-hooks": "^4.2.0",
"eslint-plugin-react-native": "^3.10.0",
"husky": "^4.3.0",
"jest": "~25.2.6",
"prettier": "^2.1.2",
"react-test-renderer": "~16.13.1",
"typescript": "~3.9.5"
}
}
This is the appdelegate.m
#import "AppDelegate.h"
#import <React/RCTBridge.h>
#import <React/RCTBundleURLProvider.h>
#import <React/RCTRootView.h>
// #import <UMCore/UMModuleRegistry.h>
// #import <UMReactNativeAdapter/UMNativeModulesProxy.h>
// #import <UMReactNativeAdapter/UMModuleRegistryAdapter.h>
// #import <EXSplashScreen/EXSplashScreenService.h>
// #import <UMCore/UMModuleRegistryProvider.h>
#import <React/RCTLinkingManager.h>
#interface AppDelegate () <RCTBridgeDelegate>
// #property (nonatomic, strong) UMModuleRegistryAdapter *moduleRegistryAdapter;
#property (nonatomic, strong) NSDictionary *launchOptions;
#end
#implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
// self.moduleRegistryAdapter = [[UMModuleRegistryAdapter alloc] initWithModuleRegistryProvider:[[UMModuleRegistryProvider alloc] init]];
self.launchOptions = launchOptions;
self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
#ifdef DEBUG
[self initializeReactNativeApp];
#else
EXUpdatesAppController *controller = [EXUpdatesAppController sharedInstance];
controller.delegate = self;
[controller startAndShowLaunchScreen:self.window];
#endif
// [super application:application didFinishLaunchingWithOptions:launchOptions];
return YES;
}
- (RCTBridge *)initializeReactNativeApp
{
RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:self.launchOptions];
RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge moduleName:#"main" initialProperties:nil];
rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1];
UIViewController *rootViewController = [UIViewController new];
rootViewController.view = rootView;
self.window.rootViewController = rootViewController;
[self.window makeKeyAndVisible];
return bridge;
}
// - (NSArray<id<RCTBridgeModule>> *)extraModulesForBridge:(RCTBridge *)bridge
// {
// NSArray<id<RCTBridgeModule>> *extraModules = [_moduleRegistryAdapter extraModulesForBridge:bridge];
// // If you'd like to export some custom RCTBridgeModules that are not Expo modules, add them here!
// return extraModules;
// }
- (NSURL *)sourceURLForBridge:(RCTBridge *)bridge {
#ifdef DEBUG
return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:#"index" fallbackResource:nil];
#else
return [[EXUpdatesAppController sharedInstance] launchAssetUrl];
#endif
}
// - (void)appController:(EXUpdatesAppController *)appController didStartWithSuccess:(BOOL)success {
// appController.bridge = [self initializeReactNativeApp];
// EXSplashScreenService *splashScreenService = (EXSplashScreenService *)[UMModuleRegistryProvider getSingletonModuleForClass:[EXSplashScreenService class]];
// [splashScreenService showSplashScreenFor:self.window.rootViewController];
// }
- (BOOL)application:(UIApplication *)application
openURL:(NSURL *)url
options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options
{
return [RCTLinkingManager application:application openURL:url options:options];
}
#end

Unable to implement Turn Socket for File transfer in iOS Using XMPP

I am using below code for creating turn Socket but every time it goes in turnSocketDidFail method so whats the wrong in the code , please help me out.
XMPPJID *JID = [XMPPJID jidWithString:#"9107#test.com/110s-Mac-mini"];
[TURNSocket setProxyCandidates:[NSArray arrayWithObjects:JID.domain, nil]];
TURNSocket *socket = [[TURNSocket alloc] initWithStream:[[NDAppDelegate shareAppDelegateInstance] xmppStream] toJID:JID];
[socket startWithDelegate:self delegateQueue:dispatch_get_main_queue()];
- (void)turnSocket:(TURNSocket *)sender didSucceed:(GCDAsyncSocket *)socket {
NSLog(#"TURN Connection succeeded!");
}
- (void)turnSocketDidFail:(TURNSocket *)sender {
NSLog(#"TURN Connection failed!");
}

Trouble creating xmpp muc room: Code 503 (service unavailable)

My code to create a room:
XMPPRoomCoreDataStorage *rosterstorage = [[XMPPRoomCoreDataStorage alloc] init];
XMPPRoom *xmppRoom = [[XMPPRoom alloc] initWithRoomStorage:rosterstorage jid:[XMPPJID jidWithString:#"groupchat#xmpp.getkismet.com/groupchat"] dispatchQueue:dispatch_get_main_queue()];
[xmppRoom activate:[[self appDelegate] xmppStream]];
if ([xmppRoom preJoinWithNickname:#"nameToCreateRoom"])
{
NSLog(#"room created");
[xmppRoom joinRoomUsingNickname:self.userName history:nil];
}
[xmppRoom fetchConfigurationForm];
[xmppRoom configureRoomUsingOptions:nil];
[xmppRoom addDelegate:[self appDelegate] delegateQueue:dispatch_get_main_queue()];
Debug:
2012-08-03 07:46:29.204 iPhoneXMPP[9887:fb03] room created
2012-08-03 07:46:29:230 iPhoneXMPP[9887:15003] SEND: <iq type="get" to="groupchat#xmpp.getkismet.com" id="B793062B-0E09-492F-BC0F-703503AAA664"><query xmlns="http://jabber.org/protocol/muc#owner"/></iq>
2012-08-03 07:46:29:237 iPhoneXMPP[9887:15003] SEND: <iq type="set" to="groupchat#xmpp.getkismet.com" id="392D5BFC-707B-4F68-A829-56F949F4E96D"><query xmlns="http://jabber.org/protocol/muc#owner"><x xmlns="jabber:x:data" type="submit"/></query></iq>
2012-08-03 07:46:29:326 iPhoneXMPP[9887:14f03] SEND: <presence to="groupchat#xmpp.getkismet.com"><x xmlns="http://jabber.org/protocol/muc"/><x xmlns="vcard-temp:x:update"><photo>91217a961321f8f6380ea2feefd0632353ad296c</photo></x><c xmlns="http://jabber.org/protocol/caps" hash="sha-1" node="http://code.google.com/p/xmppframework" ver="VyOFcFX6+YNmKssVXSBKGFP0BS4="/></presence>
2012-08-03 07:46:29:327 iPhoneXMPP[9887:14f03] RECV: <iq xmlns="jabber:client" from="groupchat#xmpp.getkismet.com" to="lee#xmpp.getkismet.com/41068195801343976386548353" type="error" id="B793062B-0E09-492F-BC0F-703503AAA664"><query xmlns="http://jabber.org/protocol/muc#owner"/><error code="503" type="cancel"><service-unavailable xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"/></error></iq>
2012-08-03 07:46:29:343 iPhoneXMPP[9887:fb03] iPhoneXMPPAppDelegate: xmppStream:didReceiveIQ:
2012-08-03 07:46:29:421 iPhoneXMPP[9887:15003] RECV: <iq xmlns="jabber:client" from="groupchat#xmpp.getkismet.com" to="lee#xmpp.getkismet.com/41068195801343976386548353" type="error" id="392D5BFC-707B-4F68-A829-56F949F4E96D"><query xmlns="http://jabber.org/protocol/muc#owner"><x xmlns="jabber:x:data" type="submit"/></query><error code="503" type="cancel"><service-unavailable xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"/></error></iq>
2012-08-03 07:46:29:440 iPhoneXMPP[9887:fb03] iPhoneXMPPAppDelegate: xmppStream:didReceiveIQ:
I see that it is creating/joining groupchat#xmpp.getkismet.com and not groupchat#xmpp.getkismet.com/groupchat like I specified. I read that this is most likely the problem. However, I have specified for the full jid, so I'm lost.
Thanks in advance to all who help.
First, take look here XEP-0045: Multi-User Chat.As you can see, first you have to discover which capabilities your user (XMPPJID) has on the Jabber server.To do this, send next command to your Jabber Server:
<iq from='user#jabber.server.com/resource' id='some_expression' to='jabber.server.com' type='get'>
<query xmlns='http://jabber.org/protocol/disco#items'/>
</iq>
or writen in objective-c using XMPP library functions:
NSError *error = nil;
NSXMLElement *query = [[NSXMLElement alloc] initWithXMLString:#"<query xmlns='http://jabber.org/protocol/disco#items'/>"
error:&error];
XMPPIQ *iq = [XMPPIQ iqWithType:#"get"
to:[XMPPJID jidWithString:#"jabber.server.com"]
elementID:[xmppStream generateUUID] child:query];
[xmppStream sendElement:iq];
Now listen response from server in XMPPStream delegate - (BOOL)xmppStream:(XMPPStream *)sender didReceiveIQ:(XMPPIQ *)iq and server response should be something like this:
<iq from='jabber.server.com' id='some_expression' to='user#jabber.server.com/resource' type='result'>
<query xmlns='http://jabber.org/protocol/disco#items'>
<item jid='im.jabber.server.com' name='Instant Message Service'/>
<item jid='conference.jabber.server.com' name='Chatroom Service'/>
</query>
</iq>
or objective c:
- (BOOL)xmppStream:(XMPPStream *)sender didReceiveIQ:(XMPPIQ *)iq
{
if([iq isResultIQ])
{
if([iq elementForName:#"query" xmlns:#"http://jabber.org/protocol/disco#items"])
{
NSLog(#"Jabber Server's Capabilities: %#", [iq XMLString]);
}
}
}
Now for every item returned send IQ to your server for it's properties and figure out which one is type of conference, something like this:
<iq from='user#jabber.server.com/resource' id='some_expression' to='conference.jabber.server.com' type='get'>
<query xmlns='http://jabber.org/protocol/disco#info'/>
</iq>
or in objective c:
- (BOOL)xmppStream:(XMPPStream *)sender didReceiveIQ:(XMPPIQ *)iq
{
if([iq isResultIQ])
{
if([iq elementForName:#"query" xmlns:#"http://jabber.org/protocol/disco#items"])
{
NSXMLElement *query = [iq childElement];
NSArray *items = [query children];
for(NSXMLElement *item in items)
{
NSError *error = nil;
NSXMLElement *sendQuery = [[NSXMLElement alloc] initWithXMLString:#"<query xmlns='http://jabber.org/protocol/disco#info'/>"
error:&error];
XMPPIQ *sendIQ = [XMPPIQ iqWithType:#"get"
to:[XMPPJID jidWithString:[item attributeStringValueForName:#"jid"]]
elementID:[xmppStream generateUUID]
child:sendQuery];
[xmppStream sendElement:sendIQ];
}
}
}
}
Listen for responses from server:
<iq from='conference.jabber.server.com' id='some_expression' to='user#jabber.server.com/resource' type='result'>
<query xmlns='http://jabber.org/protocol/disco#info'>
<identity category='conference' name='Server Group Chat Service' type='text'/>
<feature var='http://jabber.org/protocol/muc'/>
</query>
</iq>
and take group chat domain from identity with category:conference
- (BOOL)xmppStream:(XMPPStream *)sender didReceiveIQ:(XMPPIQ *)iq
{
if([iq isResultIQ])
{
if([iq elementForName:#"query" xmlns:#"http://jabber.org/protocol/disco#items"])
{
...
}
else if([iq elementForName:#"query" xmlns:#"http://jabber.org/protocol/disco#info"])
{
NSXMLElement *query = [iq childElement];
NSXMLElement *identity = [query elementForName:#"identity"];
if([[identity attributeStringValueForName:#"category"] isEqualToString:#"conference"])
{
groupChatDomain = [iq fromStr];
}
}
}
}
Finally, when we got group chat domain we can create chat room something like this:
XMPPJID *chatRoomJID = [XMPPJID jidWithUser:#"chat_room"
domain:groupChatDomain
resource:#"user"];
XMPPRoomMemoryStorage *roomMemoryStorage = [[XMPPRoomMemoryStorage alloc] init];
XMPPRoom *xmppRoom = [[XMPPRoom alloc] initWithRoomStorage:roomMemoryStorage
jid:roomChatJID
dispatchQueue:dispatch_get_main_queue()];
[xmppRoom activate:xmppStream];
[xmppRoom addDelegate:self delegateQueue:dispatch_get_main_queue()];
[xmppRoom joinRoomUsingNickname:user history:nil];
and add <XMPPRoomDelegate> protocol in your view controller and its delegates:
- (void)xmppRoomDidCreate:(XMPPRoom *)sender
- (void)xmppRoomDidDestroy:(XMPPRoom *)sender
- (void)xmppRoom:(XMPPRoom *)sender didConfigure:(XMPPIQ *)iqResult
- (void)xmppRoom:(XMPPRoom *)sender didNotConfigure:(XMPPIQ *)iqResult
- (void)xmppRoomDidJoin:(XMPPRoom *)sender
- (void)xmppRoomDidLeave:(XMPPRoom *)sender
- (void)xmppRoom:(XMPPRoom *)sender occupantDidJoin:(XMPPJID *)occupantJID withPresence:(XMPPPresence *)presence
- (void)xmppRoom:(XMPPRoom *)sender occupantDidLeave:(XMPPJID *)occupantJID withPresence:(XMPPPresence *)presence
- (void)xmppRoom:(XMPPRoom *)sender didReceiveMessage:(XMPPMessage *)message fromOccupant:(XMPPJID *)occupantJID
Note: Before inviting other users to Chat Room, you have to send and confirm room configurations (other users can be invited but messages can not be sent). So you can do this after Room is created (delegate - (void)xmppRoomDidCreate:(XMPPRoom *)sender is called) or your user has joined (delegate - (void)xmppRoomDidJoin:(XMPPRoom *)sender is called) to Chat Room.
To send and confirm room configuration do one of the following:
- (void)xmppRoomDidCreate:(XMPPRoom *)sender
{
[sender configureRoomUsingOptions:nil];
}
or
- (void)xmppRoomDidJoin:(XMPPRoom *)sender
{
[sender configureRoomUsingOptions:nil];
}
Send nil to accept default options or you can send IQ with syntax as below to your server:
<iq type='set' from='user#jabber.server.com/resource' id='some_expression' to='chat_room#conference.jabber.server.com'>
<query xmlns='http://jabber.org/protocol/muc#owner'>
<x xmlns='jabber:x:data' type='submit'>
<field var='FORM_TYPE'>
<value>http://jabber.org/protocol/muc#roomconfig</value>
</field>
<field var='muc#roomconfig_roomname'>
<value>My Chat Room</value>
</field>
.
.
.
<x>
</query>
</iq>
or objective c code:
NSError *error = nil;
NSXMLElement *query = [[NSXMLElement alloc] initWithXMLString:#"<query xmlns='http://jabber.org/protocol/muc#owner'/>"
error:&error];
NSXMLElement *x = [NSXMLElement elementWithName:#"x"
xmlns:#"jabber:x:data"];
[x addAttributeWithName:#"type" stringValue:#"submit"];
NSXMLElement *field1 = [NSXMLElement elementWithName:#"field"];
[field1 addAttributeWithName:#"var" stringValue:#"FORM_TYPE"];
NSXMLElement *value1 = [NSXMLElement elementWithName:#"value"
stringValue:#"http://jabber.org/protocol/muc#roomconfig"];
[field1 addChild:value1];
NSXMLElement *field2 = [NSXMLElement elementWithName:#"field"];
[field2 addAttributeWithName:#"var" stringValue:#"muc#roomconfig_roomname"];
NSXMLElement *value2 = [NSXMLElement elementWithName:#"value"
stringValue:#"My Chat Room"];
[field2 addChild:value2];
//Add other fields you need, just like field1 and field2
[x addChild:field1];
[x addChild:field2];
[query addChild:x];
NSXMLElement *roomOptions = [NSXMLElement elementWithName:#"iq"];
[roomOptions addAttributeWithName:#"type" stringValue:#"set"];
[roomOptions addAttributeWithName:#"id" stringValue:[xmppStream generateUUID];
[roomOptions addAttributeWithName:#"to" stringValue:#"chat_room#conference.jabber.server.com"];
[roomOptions addChild:query];
[sender configureRoomUsingOptions:roomOptions];
and list of all possible Configuration Form fields is here

Resources